Advertisement
Josif_tepe

Untitled

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