Categories: Uncategorized

C++ Program to Reverse Any Given Number Using Loop

Reverse Any Number

This Program is Written in C++.

This Program is use to reverse any number.

Example: If the user will type 12345 then this program will reverse this value and you will get 54321 as a result.

This Program is written in C++ but Logic of this program can be implemented with the help of other languages too example C Language, C#, Java, PHP, JavaScript etc.

           
Code :

Output :

Output

//write a program to reverse a Given Number ?

#include<iostream>

using namespace std;

main()
{
 int n;
 int rev = 0;
 
 cout << "Enter a Number which you want to reverse : ";
 cin >> n;
 
 int temp = n;
 
 while( temp != 0)
 {
  rev = rev * 10;
  rev = rev + temp%10;
  temp = temp/10;
 }
 
 cout << "The Reverse of " << n << " is : " << rev;
 
 
}

reecry

Recent Posts

Insta360 – Videos keep exporting backwards | Wrong side render in insta360

https://youtu.be/0RRUOIvmuWA I realized that I had my camera set up incorrectly, so when I upload…

6 months ago

Make Animated progress step bar using Figma

https://youtu.be/C3oFfV20K_c Make Animated progress step bar using Figma

8 months ago

How to Hide All Grids in Figma

https://youtu.be/o3pSH_oRzko How to Hide All Grids in Figma

8 months ago

How to Create Responsive Tool tip in figma

https://youtu.be/hdSUylKSsho How to Create Responsive Tool tip in Figma

8 months ago

Pixel Grid not visible in figma | How to Turn on figma Pixel Grid

https://youtu.be/AEiH7dSDhKo Having issue in figma pixel grid? learn how to show/ hide figma pixel grid…

8 months ago

Fix External Monitor Lag on Mac OS Ventura

https://youtu.be/iilYzHg9LwQ There are some issues going on in ventura OS its still in development phase…

1 year ago