sandra0309

vezba21

Dec 14th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.18 KB | None | 0 0
  1. #include<stdio.h>
  2. int main ()
  3. {
  4.  int n,suma=0,cifra;
  5.    scanf("%d",&n);
  6.    while (n)
  7.    {
  8.      cifra=n%10;
  9.      suma+=cifra;
  10.      n/=10;
  11.  
  12.    }
  13.    printf("%d",suma);
  14.    return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment