Wednesday, 5 February 2014

c programm reverse the number

 c programm reverse the number

program take input from user add print reverse order with out loop
#include<stdio.h>
#include<conio.h>
main()
{
int n,n1,n2,n3,n4,rev;
printf("Enter four digit number=");
scanf("%d",&n);
n1=n%10;
n2=n/10%10;
n3=n/10/10%10;
n4=n/10/10/10%10;
rev=1000*n1+100*n2+10*n3+n4;
printf("sapert num \n n1=%d \n n2=%d \n n3=%d \n n3=%d \n",n1,n2,n3,n4);
printf("\n Reverse of 4 digits number =%d",rev);
getch();
}

No comments:

Post a Comment