Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int v[100];
- int duplicare(int n) {
- int c = 0, i = 0;
- while (n != 0) {
- c++; i++;
- v[i] = n % 10;
- n /= 10;
- }
- for (i = c; i >= 1; i--) {
- n = n * 10 + v[i];
- if(v[i] % 2 == 0)
- n = n * 10 + v[i] / 2;
- }
- return n;
- }
- int main () {
- int n;
- cin >> n;
- cout << duplicare(n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement