Mirbek

Сумма

Jan 20th, 2022
1,034
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.     ios::sync_with_stdio(0);
  7.  
  8.     long long n, revN = 0, temp;
  9.  
  10.     cin >> n;
  11.  
  12.     temp = n;
  13.  
  14.     while (temp > 0) {
  15.         int x = temp % 10;
  16.         revN = revN * 10 + x;
  17.         temp /= 10;
  18.     }
  19.  
  20.     cout << n + revN << endl;  
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment