Mitkashin

Најди го збирот на сите скриени броеви во текстот / Лаб 3.5

Oct 27th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. //Пример влез abc10ght5js Пример излез 15
  2.  
  3. #include <stdio.h>
  4.  
  5. int main(){
  6.     char c;
  7.     int zbir=0,br=0,x;
  8.  
  9.     while((c=getchar())!='\n'){
  10.         if((c>='0') && (c<='9')){
  11.             x=c-'0';
  12.             br=br*10+x;
  13.         }
  14.         else {
  15.             zbir+=br;
  16.             br=0;
  17.         }
  18.     }
  19.     printf("%d", zbir+br);
  20. }
Add Comment
Please, Sign In to add comment