0
How to swap numbers any number of digits in JavaScript and c++ ?
2 ответов
+ 8
1) Make a temporary variable
2) Store value of first variable in temporary variable
3) Assign value of second variable to first variable
4) Assign value of temporary variable to second variable
+ 2
If asking to change 123 to 321:
Make the output variable (string or integer)
For each digit,...
Get the digit
Put it into place in output
Endfor
Strings are the easiest to process as integers require math to get each digit where string can just be indexed.