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();
}

6 comments:

  1. sry tosay but this is not the correct program as when i tried it , it is giving wrong output, it is not showing the reversed no. but some different pattern

    ReplyDelete
  2. I think inside the while loop
    Rev=
    (Rev*10)+rem

    ReplyDelete
  3. Good
    Here is a link for C/C++ programs and pointer programs. This may be useful for you.

    C Programs

    C++ Programs

    ReplyDelete
  4. C++ Program to Reverse a Number

    Reverse of number means reverse the position of all digits of any number. For example reverse of 536 is 635

    ReplyDelete
  5. C++ Program to Reverse a Strings

    Reverse a String means reverse the position of all character of String. You can use swapping concept to reverse any string in c++.

    ReplyDelete
  6. Nice program . visit more good coding program collection Click Here

    ReplyDelete

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