View Code of Problem 54

#include<bits/stdc++.h>
using namespace std;
#define max 10000
int main(){
	int a[max],n,i = 0;
	scanf("%d",&n);
	while(n){
		a[i++] = n%10;
		n/=10;
	}
	for(int k = i-1;k>=0;k--){
		if(k==0)cout<<a[k];
		else cout<<a[k]<<" ";	
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 54