Hello.. can anybody helps me? i'm trying to write a c++ program.. that does like this... enter a number like 123 and the program should read it in reverse... like 321!
i did it.. but there z something wrong... i cant guess where z it...
if i put 12.. it would give me 212121..................... and if i give it 123 it wuld give me infinity and wrong numbers.. like 3231321123..... !!!! :confused: ... :(Code:#include <iostream.h> void main(){ int num,n,x; cout<<"Enter a positive number please\n"; cin>>num; for(int j=1; num>=j; j*=10){ for(int i=10; x>=n ; i*=10){ n= num%i; x= n/j; cout<<x; } }