Simple C Program that will Reverse Digits of any Number

SaveSavedRemoved 0
Deal Score0
Deal Score0

C is a procedural language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support.


C was therefore useful for many applications that had formerly been coded in assembly language, such as in system programming. If you are a programmer, or if you are interested in becoming a programmer, there are a couple of benefits you gain from learning C:

  • You will be able to read and write code for a large number of platforms — everything from microcontrollers to the most advanced scientific systems can be written in C, and many modern operating systems are written in C.
  •     The jump to the object-oriented C++ language becomes much easier. C++ is an extension of C, and it is nearly impossible to learn C++ without learning C first.

In this post, I am going to write a program that reverses a number or digits Using  C, a very basic and commonly asked question in interviews and exams.

//Source Code:
#include<stdio.h>
int main ()
{
    int number, rev;
 printf("--- Simple C Program that will Reverse Digits of any Number ---\n\n");
    printf("Enter any number \n");
    scanf("%d",&number);
    do 
    {
                        
                        rev = number % 10;
                        printf ("%d", rev);
                        number = number / 10;
                        
    }
    while (number != 0);
      {
      printf("\n");                    
      }
    getch();
    return 0;
    }

Hi! My name is Ikenna Gabriel Ifenna and I am a professional IT consultant. I have an excellent understanding of how computer works and I love to read, write and research about tech kinds of stuff. I design websites, knows how to use WordPress multisite to create complex web applications and I design e-Commerce websites for businesses. When I am not doing any of these, you can find me riding bicycle with Strava. Want to work together? I would love to hear from you.

What do you want to do? Tell us in the comments.
Register New Account
Reset Password