// C code to reverse the digits of a user entered number
#include<stdio.h>
/*Function to reverse the digits of a number*/
void reverse_digits(n)
{
while(n!=0)
{
printf("%d",n%10);
n=n/10;
}
}
int main()
{
int n;
printf("Enter a no.\n");
scanf("%d",&n);
printf("The reverse no.is\n");
reverse_digits(n);
printf("\n");
}
#include<stdio.h>
/*Function to reverse the digits of a number*/
void reverse_digits(n)
{
while(n!=0)
{
printf("%d",n%10);
n=n/10;
}
}
int main()
{
int n;
printf("Enter a no.\n");
scanf("%d",&n);
printf("The reverse no.is\n");
reverse_digits(n);
printf("\n");
}
No comments:
Post a Comment