Tech Study

How To C++ Program To Reverse a Number

Introduction:

c++ program to reverse a number

I have used CodeBlocks compiler for debugging purpose. But you can use any C++ programming language compiler as per your availability.

#include <iostream>
using namespace std;
 
int main()
{
    int num=0, i;
 
   //Reading number
    cout<<"Enter any number: "<<endl;
    cin>>num;
    /*Running loop from the number entered by user,
      and Decrementing by 1*/
    for(i=num; i>=1; i--)
    {
        cout<<i;
    }
    return 0;
 
}

Result

Write C++ program to print all natural numbers in reverse order
Write c++ program to reverse a number in reverse order

To learn more about c++ viste these links ;

Write C++ program to check even or odd number using switch case
Write C++ program to check prime and armstrong numbers using function

TaggedWrite C++ program to print all natural numbers in reverse order

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more