Write a program to accept a number from the user and reverse it. Do While Loop
Answers
Answered by
0
C Program to reverse digits of a number using do while loop///
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
int rev=0, rem=0;
printf("\n Enter a number: ");
scanf("%d",&num);
do
{
rem = num%10;
rev = rev*10+rem;
num = num/10;
}while(num>0);
printf("\n reverse number = %d",rev);
getch();
}
Similar questions
Math,
7 months ago
Social Sciences,
7 months ago
English,
7 months ago
Social Sciences,
1 year ago
Math,
1 year ago
Math,
1 year ago