Advertisement
Josif_tepe

Untitled

Apr 30th, 2021
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int zbir_cifri(int i) {
  6.     if(i == 0) {
  7.         return 0;
  8.     }
  9.     return zbir_cifri(i / 10) + (i % 10);
  10. }
  11. int main() {
  12.     int N;
  13.     scanf("%d", &N);
  14.     printf("%d\n", zbir_cifri(N));
  15.     return 0;
  16. }
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement