Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int sum=0,prev=0;
- char c;
- while(scanf("%c",&c)&&c!='!'){
- if(c=='0'||c=='1'||c=='2'||c=='3'||c=='4'||c=='5'||c=='6'||c=='7'||c=='8'||c=='9'){
- prev*=10+c-'0';
- }
- else{
- sum+=prev;
- prev=0;
- }
- }
- sum+=prev;
- printf("%d", sum);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement