/*WAP to display reverse of enter no. using for loop*/
#include<stdio.h> #include<conio.h> void main() { int n,rem,i,rev=0; clrscr(); printf("enter no."); scanf("\n%d",&n); for(i=n;i>0;) { rem=i%10; rev=rev*10 +rem; i=i/10; } printf("reverse is=%d",rev); getch(); }
No comments:
Post a Comment