Advertisement
Filip13

obrni cetvorocifren broj

Oct 10th, 2022
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int num;
  7. cin >> num;
  8.  
  9. int x1 = num / 1 % 10;
  10. int x2 = num / 10 % 10;
  11. int x3 = num / 100 % 10;
  12. int x4 = num / 1000 % 10;
  13.  
  14.  
  15. cout << x1 * 1000 + x2 * 100 + x3 * 10 + x4 * 1;
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement