#include <stdio.h>
int main(void)
{
unsigned int number = 0;
unsigned int single_digit = 0;
unsigned int ten_digit = 0;
unsigned int hundreds_digit = 0;
unsigned int thousands_digit = 0;
scanf("%d", &number);
thousands_digit = number / 1000;
hundreds_digit = number % 1000 / 100;
ten_digit = number % 1000 % 100 / 10;
single_digit = number % 1000 % 100 % 10;
printf("%d, %d, %d, %d\n", thousands_digit, hundreds_digit, ten_digit, single_digit);
return 0;
}
C语言开发笔记(四)获取整数的个十百千位
最新推荐文章于 2024-10-03 19:23:53 发布