Advertisement
RAJIBRAJU

1.revers in function

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