Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <cmath>
- #include <time.h>
- #include <stdlib.h>
- #define SPACE " "
- using namespace std;
- // Init Void
- int reverser(int n);
- int main(void)
- {
- int input, output;
- cout << "Entrer l'entier a inverser: ";
- cin >> input;
- output = reverser(input);
- cout << output << endl;
- system("pause");
- return 0;
- }
- int reverser(int n)
- {
- int result = 0;
- while (n > 10)
- {
- result += n % 10;
- n /= 10;
- result *= 10;
- }
- result += n;
- return result;
- }
Add Comment
Please, Sign In to add comment