正序分解整数 C语言程序设计

#include
int main()
{
	int num=0,sum=0,count=0;
	scanf("%d",&num);
	if(num!=0)
	{
		while(num>0)
		{
			sum=sum*10+num%10;
			num=num/10;
			count++;
		}
			printf("%d",sum%10);
			sum=sum/10;
			count--;
			while(count>0)
			{
				printf(" %d",sum%10);
				sum=sum/10;
				count--;
			}
	}
	else
	{
		printf("%d",num);
	}
	return 0;
}

你可能感兴趣的:(C语言,c语言)