How to reverse any number using function with arguments?
CODE
How to reverse any number
using function with arguments?
//Write a program to
find reverse of a number using function with arguments…
int
main()
{
int n;
printf("\n enter N:");
scanf("%d",&n);
void reverse(int n);
reverse(n);
}
void
reverse(n)
{
int r,rev=0;
while(n!=0)
{
r=n%10;
rev=rev*10+r;
n=n/10;
}
printf("\n reverse of the
number=%d",rev);
}
Output:
enter N:456
reverse of the number=654
How to reverse any number using function with arguments?
Reviewed by Unknown
on
December 31, 2018
Rating:
No comments:
If you have any doubt or query ,comment below: