Showing posts with label Reverse a number. Show all posts
Showing posts with label Reverse a number. Show all posts

Write a Program to print reverse of a given number

#include<stdio.h>
#include<conio.h>

void main()
{
int no,rem,rev=0;
clrscr();
printf("Enter a no:");
scanf("%d",&no);
while(no>0)
{
rem=no%10;
rev=(rem*10)+rev;
no=no/10;
}
printf("Reversed number =%d",rev);
getch();
}

Related Post

Array:
String functions:
General (Loops-for/while)
Write a Program to print reverse of a given number Write a Program to print Product of Digits (eg. 212=2*1*2=4) of a given number Write a C++ Program to Convert Binary into Decimal Number