C Code to print number in reverse

Write a program to print the given number in reverse order for e.g 123 as 321

Questions by Maddali Ramya

Showing Answers 1 - 1 of 1 Answers

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.  

  Was this answer useful?  Yes

Give your answer:

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

Answer Question

Click here to Login / Register your free account


 
Send   Reset

 

Related Answered Questions

 

Related Open Questions