解题思路:
我的代码适合一切位数的数!!
注意事项:
参考代码:
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
char b[10];
int i=0;
int n;
scanf("%d",&n);
int digit=0;
int mark=1;
int t=n;
while(t>9)
{
mark*=10;
t/=10;
}
//printf("%d",mark);
while(mark>0)
{
digit=n/mark;
n=n%mark;
mark=mark/10;
b[i]=digit+'0';
printf("%c",b[i]);
if(mark>0)
{
printf(" ");
}
i++;
}
return 0;
}
0.0分
0 人评分
C二级辅导-公约公倍 (C语言代码)浏览:2122 |
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:623 |
WU-蓝桥杯算法提高VIP-交换Easy (C++代码)浏览:1107 |
WU-蓝桥杯算法提高VIP-勾股数 (C++代码)浏览:1592 |
WU-字符串比较 (C++代码)浏览:754 |
WU-整除问题 (C++代码)浏览:610 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:664 |
Minesweeper (C语言描述,蓝桥杯)浏览:1122 |
蚂蚁感冒 (C语言代码)浏览:1319 |
1128题解(返回值为数组的情况)浏览:450 |