Advertisement
deko96

[Лаб 6] Броеви

Nov 28th, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int suma(int vlez)
  4. {
  5.     if(vlez < 100)
  6.         return vlez;
  7.     else {
  8.             return vlez % 100 + suma(vlez/10);
  9.     }
  10. }
  11. int main()
  12. {
  13.     int br;
  14.     scanf("%d", &br);
  15.     printf("%d", suma(br));
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement