Advertisement
dllbridge

Untitled

Sep 15th, 2019
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1.  
  2. #include  <stdio.h>
  3. #include <locale.h>      
  4.  
  5. ////////////////////////////////////////
  6. int main()                            //
  7. {
  8.    
  9.    
  10.     int a   = 753; // 7 + 5 + 3 = 15
  11.     int b   =   0;
  12.     int sum =   0;
  13.    
  14.    
  15.     sum = sum + a%10;
  16.    
  17.     a = a/10;
  18.    
  19.     sum = sum + a%10;   // 8
  20.  
  21.     a = a/10;
  22.    
  23.     sum = sum + a%10;   // 8       
  24.    
  25.     printf("sum = %d\n", sum);
  26.    
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement