Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to reverse number

Posted By: Rafael Costa     Category: C Programming     Views: 4937

Write a program to reverse number.

Code for Program to reverse number in C Programming

#include<stdio.h>
void main()
{
        int number,sum=0,rem;
        printf("Enter the number =>");
        if(scanf("%d",&number)==1)
        {
                sum=0;
                for( ;number>0; )
                {
                rem=number%10;
                sum=sum*10+rem;
                number=number/10;
                }
                printf("The number is =>%d",sum);
        }
        else
        {
        printf("entet correct value");
        }


===================================OUTPUT==================================

Enter the number =>23
The number is =>32
  
Share: 


Didn't find what you were looking for? Find more on Program to reverse number Or get search suggestion and latest updates.

Rafael  Costa
Rafael Costa author of Program to reverse number is from Salvador, Brazil.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!