Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include<iostream>
using namespace std;
int main(){
int number;
int reverse = 0;
cout<<"enter a number :";
cin>>number;
while(number>0){
int last = number % 10;
reverse = reverse * 10 + last;
number = number / 10;
}
cout<<reverse;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment