C program to reverse 4 digit number,
C program to reverse four digit number without using loop ,
c program logic to reverse given number ,
#include#include
void main()
{
int n,rem,newn,a;
clrscr();
printf("Enter the 4 digit number=");
scanf("%d",&n);
a=n;
rem=n%10;
newn=rem*1000;
n=n/10;
rem=n%10;
newn=newn+(rem*100);
n=n/10;
rem=n%10;
newn=newn+(rem*10);
n=n/10;
rem=n%10;
newn=newn+(rem*1);
n=n/10;
printf("\n\nThe original number is=%d",a);
printf("\n\n\n\nAfter reverse the number is=%d",newn);
getch();
}