#include<stdio.h>
int main(){
int n = 123456;
int unitPlace = n / 1 % 10;//个位
int tenPlace = n / 10 % 10;//十位
int hundredPlace = n / 100 % 10;//百位
int thousandPlace = n / 1000 % 10;//千位
printf("个位:%d\n十位:%d\n百位:%d\n千位:%d\n", unitPlace, tenPlace, hundredPlace, thousandPlace);
getchar();
return 0;
}
C语言提取一个数的十位个位百位千位
猜你喜欢
转载自blog.csdn.net/qq_38900441/article/details/105253684
今日推荐
周排行