reverse number Program in C

C Program to reverse number

In this Program we will using loop and arithmetic operators and make a Program to reverse Integer Numbers. First, we will getting number as input from the user and reversing that number.
Lets Understand Program Steps
  1. #include<stdio.h>  
  2. #include<conio.h>  
  3. main()  
  4. {  
  5. int n, reverse=0, rem;  
  6. clrscr();  
  7. printf(“Enter a number: “);  
  8.   scanf(“%d”, &n);  
  9.   while(n!=0)  
  10.   {  
  11.      rem=n%10;  
  12.      reverse=reverse*10+rem;  
  13.      n/=10;  
  14.   }  
  15.   printf(“Reversed Number: %d”,reverse);  
  16. getch();  
  17. }  
Output:
Enter a number: 123
Reversed Number: 321

2 comments

  1. Please lеt me know if ʏou’re looking for а article author for your blog.

    You have some really good articles and I think I
    would be a good asset. If you ever want to take some of the load
    off, I’d absolutely love to write some matеrial for your blog
    in exchange for a link back to mine. Please send me an e-mail if intereѕted.
    Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *