View Code of Problem 54

#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	long int n;
	scanf("%ld",&n);
	int i=0,a[50];
	while(n>0)
	{
		a[i++]=n%10;
		n=(n-n%10)/10;
	}
	for(int j=i-1;j>=0;j--)
	{
		if(j==0)
			printf("%d\n",a[j]);
		else
			printf("%d ",a[j]);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 54