+ 1
How to reverse the input in c++?
A
4 Antworten
+ 7
I am considering it as int, so
int num = 1234, reversed = 0;
while (num > 0)
{
reversed = (num % 10) + (reversed * 10)
num /= 10 ;
}
+ 5
what is the data type of your input?
integer, string, array or anything else?
0
depending on input you could convert it to an array and reverse it that way.
0
1234 type