This is a Cpp program which finds the reverse of a given number.
PROGRAM :
PROGRAM :
#include <iostream> using namespace std; int main() { int n,copy_num,remainder,reverse = 0; cout << "Enter a number : \t" ; cin >> n; copy_num = n; while(n) { remainder = n%10; reverse = reverse*10+remainder; n=n/10; } cout << "\nThe Reverse of " << copy_num << " is : " << reverse << endl; return 0; }OUTPUT :
Cpp Programming - Reverse of a number |