Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int x;
- int a1=0, a2=0, a3=0;
- int x1=0, x2=0;
- cout << "x= "; cin >> x;
- for(int i=1; i<=5; i++){
- if(i == 3)
- a3 = x % 10;
- if(i > 1 && i < 5)
- a2 = a2 * 10 + x % 10;
- a1 = a1 * 10 + x % 10;
- x /= 10;
- }
- for(int i=1; i<=5; i++){
- if(i > 1 && i < 5){
- x2 = x2 * 10 + a2 % 10;
- a2 /= 10;
- }
- x1 = x1 * 10 + a1 % 10;
- a1 /= 10;
- }
- cout << " " << a3 << "\n " << x2 << "\n" << x1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement