GeekInterview.com
Series: Subject: Topic:
Question: 70 of 828

C Code to print number in reverse

Write a program to print the given number in reverse order for e.g 123 as 321
Asked by: Maddali Ramya | Member Since Jun-2011 | Asked on: Jun 30th, 2011

View all questions by Maddali Ramya

Showing Answers 1 - 1 of 1 Answers
Padma Sirisha

Answered On : Jul 13th, 2011

View all answers by Padma Sirisha

Here is the code

Code
  1. #include<stdio.h>
  2. void main()
  3. {
  4.    int num,remainder,reverseno;
  5.    printf("enter the u want number");
  6.    scanf("%d",&num);
  7.    while(num<=0)
  8.    {
  9.      remainder=num%10;
  10.      reverseno=(reverseno*10)+remainder;
  11.      num=num/10;
  12.    }
  13.   printf("the reverse number is;%d",reverseno);
  14. }
  15.  

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.