View Code of Problem 54

#include<bits/stdc++.h>
using namespace std;
int main() {
	int num[100];
	long int n;
	int k=0;
	cin>>n;
	while(n>0){
		num[k++]=n%10;
		n/=10;
	}
	for(int i=k-1;i>=0;i--){
		cout<<num[i];
		if(i!=0){
			cout<<" ";
		}
	} 
	return 0;
}

Double click to view unformatted code.


Back to problem 54