View Code of Problem 54

#include<iostream>
using namespace std;
int main()
{
	int n,a[100]={0},i=0;
	cin>>n;
	while(n>0)
	{
		a[i]=n%10;
		i++;
		n=n/10;		
	}
	for(int j=i-1;j>=0;j--)
	  {
	  	cout<<a[j];
	  	if(j!=0) cout<<" ";
	  }
}

Double click to view unformatted code.


Back to problem 54