Our problem is to write a program containing a function that will change the five-digit number to its reverse form.
example:
☺inputed value: 54321
☺output: 12345
The Solution:
#include
#define p printf
#define s scanf
main()
{
int x;
clrscr();
p("enter a fine digit number:");
s("%d",&x);
reverse(x);
getch();
}
reverse(int c)
{
int a,b;
for (a=1;a<=5;a++)
{
b=c%10;
p("%d",b);
c=c/10
}
}
0 comments:
Post a Comment