Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cmath>
- #include <cstdio>
- #include <vector>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- #define ll long long
- void printFromLeft (ll n){
- if ( n==0 ) return ;
- printFromLeft(n/10);
- int r=n%10;
- cout<<r<<" ";
- }
- void printFromRight(ll n){
- if ( n==0 ) return ;
- int r= n%10;
- cout<<r<<" ";
- printFromRight(n/10);
- }
- int main() {
- ll n;
- cin >> n;
- printFromLeft(n);
- cout<<endl;
- printFromRight(n);
- /* Enter your code here. Read input from STDIN. Print output to STDOUT */
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment