View Code of Problem 54

#include<stdio.h>
int main()
{
	long x;
	scanf("%d",&x);
	long c=x;
	long t=1;
	int d;
	while(c>0)
	{
		c/=10;
		t*=10;
	}
	t/=10;
	while(t>0)
	{
		d=x/t;
		printf("%d",d);
		if(t>9)
		{
			printf(" ");
		}
		x=x%t;
		t/=10;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 54