Advertisement
kaloon

zbir

Oct 27th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(){
  3.     int zbir=0,prethoden=0;
  4.     char c;
  5.     while(scanf("%c",&c)&&c!='!'){
  6.         if(c=='0'||c=='1'||c=='2'||c=='3'||c=='4'||c=='5'||c=='6'||c=='7'||c=='8'||c=='9'){
  7.             prethoden = prethoden*10 + c - '0';
  8.         }
  9.         else{
  10.         zbir += prethoden;
  11.             prethoden = 0;
  12.         }
  13.     }
  14.     zbir +=prethoden;
  15.     printf("%d",zbir);
  16.  
  17.  
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement