Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Need some help about reversing numbers (http://www.go4expert.com/forums/help-reversing-t22288/)

gotto 1Jun2010 18:40

Need some help about reversing numbers
 
Hello!
I've begun programming on Dev C++ and I need some help. The input should be like 123 and the output 321. How can I make this? I don't understand it much right now... This is my code so far:
#include<iostream.h>
int main ()
{
int n,k,a,b,c;
cin >> n >> k;
a=n/100;
b=n/10%10;
c=n%10;
if ((a+b+c)%k==0)
cout << "yes" << " " << c,b,a << endl;
else cout << "no" << " " << (a+b+c)*k << endl;
system ("PAUSE");
return 0;
}

gotto 1Jun2010 19:09

Re: Need some help about reversing numbers
 
Nevermind, I got it.


All times are GMT +5.5. The time now is 19:22.