April 07, 2021

Reverse given 5 digit numbers using C++ programming

 Question: If a five-digit number is input through the keyboard. Write a program to reverse a number.


solution : 


Screenshot



source code 

#include <iostream>

#include<conio.h>

using namespace std ;

int main()

{

int n;

int rev[6],revn=0;

cout<<"Enter a 5 digit number : ";

cin >>n;

for(int i=1; i<6; i++)

{

rev[i]=n%10;

n=n/10;

}

for(int i=1; i<6; i++)

{

cout<<rev[i];

}

}

No comments:

Post a Comment

find the cube of the range given digits. || codeAj

Find the cube of the range given Digits. Source Code r= int ( input ( "enter the range of digit : " )) def number_conter (n): ...