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

Python Examples

Introduction: Python Examples are the basic programming concepts of python like python syntax,python data types,,python operators,python if else,python comments etc.. …

Read more

C String Functions

C String Functions perform certain operations, It provides many useful string functions which can come into action. The <string.h> header …

Read more