Â
In this, we are going to see a program in which we will accept 5 digit number and reverse it in C Programming Language.
// WAP to accept 5 digit number and reverse it
#include <stdio.h>
void main()
{
int reverse = 0, num, remainder;
printf("Enter the 5 digit number: ");
scanf("%d", &num);
printf("The original number is %d \n", num);
while (num != 0)
{
remainder = num % 10;
reverse = reverse * 10 + remainder;
num = num / 10;
}
printf("The reverse number is %d", reverse);
}
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP