Computer Science, asked by maharanaparsu, 1 year ago

write a program to reverse a given number?
C++ program

Answers

Answered by sivasham08
5
#include <iostream>using namespace std;
int main(){    int n, reversedNumber = 0, remainder;
    cout << "Enter an integer: ";    cin >> n;
    while(n != 0)    {        remainder = n%10;        reversedNumber = reversedNumber*10 + remainder;        n /= 10;    }
    cout << "Reversed Number = " << reversedNumber;
    return 0;}
Similar questions
Math, 8 months ago