program to reverse a number
#include<stdio.h> #include<string.h> main() { int n,i,result=0;; printf("enter any number...\n"); scanf("%d",&n); printf("number before reverse..%d\n",n); while(n>0) { result=result*10; result=result+(n%10); n=n/10; } printf("reversed number is=%d\n",result); }OutPut:
enter any number... 12 number before reverse..12 reversed number is=21