#include <stdio.h> int reverse(int n){ int rem; int rev=0; while(n!=0){ rem=n%10; rev = rev*10+ rem; n=n/10; } return rev; } int main(){ int num; printf("enter the number "); scanf("%d",&num); printf("%d",reverse(num)); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter