paranid5

дз 2

Feb 25th, 2021
309
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.  
  3. int main()
  4. {
  5.     int n = 0;
  6.     int sum = 0;
  7.  
  8.     scanf("%d", &n);
  9.  
  10.     for (; n; n /= 10)
  11.         sum += n % 10;
  12.  
  13.     printf("%d", sum);
  14.     return 0;
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment