1,求几位数
#include <stdio.h>
int Getfigures(int n) //统计整数n的位数
{
int count=0;
do
{
count++;
n/=10;
}while(n!=0);
return count;
}
/* int Getfigures(int n) //若要用此函数,则对0求其位数会出错,可加if-else语
句补缺。此方法采用while()语句,上面采用do-while() 语句,这就体现了while()语句
和do-while() 语句的区别,事实证明二者只在0和1上有区别。
{
int count=0;
while(n!=0)
{
count++;
n/=10;
}
return count;
}
*/
顺序输出每位数
void PrintOrder(int n) //顺序输出各个位上的数字
{
int count;
count=Getfigures(n);
int power=1;
for(int i=0;i<count-1;i++)
{
power*=10;
}
do
{
printf("%d",n/power);
n%=power;
power/=