Doubt in the question

#include
using namespace std;
int main() {
int n;
cin>>n;
cout<<endl;
int r;
while(n!=0){
r=n%10;
cout<<r;
n=n/10;
}
}
i wrote this , it is working but how do i check if reverse was calculated ? in this we are just printing number by number ,how do we check if reverse was calculated

hi @chitranshanmol07 instead of just printing each digit, you should try storing it in a variable.

is this the right approach ??—>>>>>#include using namespace std; int main() { int n; cin>>n; cout<<endl; int r; int rev=0; int multi=1; while(n!=0){ r=n%10; rev=r+(rev*10); n=n/10; cout<<rev<<endl; } cout<<rev; }

hi @chitranshanmol07 yes this is correct