解题思路:
我的代码适合一切位数的数!!
注意事项:
参考代码:
#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++代码)——(22行代码)真的只需要两个变量就够了浏览:1808 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:563 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:577 |
不容易系列 (C语言代码)浏览:670 |
C语言程序设计教程(第三版)课后习题6.6 (C语言代码)浏览:624 |
C语言训练-阶乘和数* (C语言代码)-------- 呆板写法浏览:1362 |
【金明的预算方案】 (C++代码)浏览:940 |
用筛法求之N内的素数。 (C语言代码)浏览:808 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:863 |
【偶数求和】 (C语言代码)浏览:431 |