函式_倒著印數列

 avatar
user_3763047219
c_cpp
2 years ago
302 B
2
Indexable
Never
#include <stdio.h>
void print_digit(int number)
{
	int digit[40];
	int index = 0;
	while (number != 0) {
		digit[index] = number % 10;
		number = number / 10;
		index++;
	}
	for (int i = index - 1;i >= 0;i--) {
		printf("%d\n", digit[i]);
	}
}
int main()
{
	int number = 467326;
	print_digit(number);
}