REVERSE NUMBER PROGRAME
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,s=0;
clrscr();
printf("\n a= ");
scanf("%d",&a);
while(a>0)
{
a-c=a%10;
printf("%d",c);
s=(s*10)+c;
a=a/10;
}
getch();
}
OUTPUT;
a=1234
c s a
4 0 123
3 4 12
2 43 1
1 432
Answer is 4321//
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,s=0;
clrscr();
printf("\n a= ");
scanf("%d",&a);
while(a>0)
{
a-c=a%10;
printf("%d",c);
s=(s*10)+c;
a=a/10;
}
getch();
}
OUTPUT;
a=1234
c s a
4 0 123
3 4 12
2 43 1
1 432
Answer is 4321//
0 comments:
Post a Comment