【算法】正序分解整数 c语言

#include "pch.h"
#include<stdio.h>
int main()
{
	//13452 => 1 3 4 5 2
	int temp;
	int t; 
	int makt = 1;
	scanf("%d",&temp);
	t = temp;
	while (temp>=10) {//多了一个0
		makt *= 10;
		temp /= 10;
	}
	do {
		printf("%d ",t/makt);
		t %= makt;
		makt /= 10;
	} while (makt>0);
	return 0;
}

猜你喜欢

转载自blog.csdn.net/kevin_nan/article/details/89892801