Write a user-defined function to perform Revers the Number.
CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
int res(int);
clrscr();
printf("Enter The Number:");
scanf("%d",&a);
b=res(a);
printf("Revers Number is=%d",b);
getch();
}
int res(int x)
{
int y=0;
while(x)
{
y=y*10+x%10;
x=x/10;
}
return y;
}
OUTPUT:
CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
int res(int);
clrscr();
printf("Enter The Number:");
scanf("%d",&a);
b=res(a);
printf("Revers Number is=%d",b);
getch();
}
int res(int x)
{
int y=0;
while(x)
{
y=y*10+x%10;
x=x/10;
}
return y;
}
OUTPUT:
<<BACK |
Comments
Post a Comment