#include
#include
int main(){
int i,tem,t;
char a[1000];
scanf("%s",a);
t=strlen(a);
for(i=0;iprintf("%c",a[i]);
if((t-i-1)%3==0&&i!=t-1)
printf(",");
}
printf("\n");
return 0;
}
#include
#include
void main()
{
char a[100]; /*数字可能很大很长,用字符串表示*/
int count=0,i,j,len=0;
printf("Please input number:");
gets(a);
len=strlen(a);
count=len%3;
for(j=0;j
printf("%c",a[j]);
printf(",");
}
count=0;
for(i=j;i
printf("%c",a[i]);
count++;
if((count==3)&&(i
printf(",");
count=0;
}
}
}
这个很简单啊
#include
void main(void)
{
long sum = 0;
long a[10];
int j, i = 0;
printf("请输入数据:");
scanf("%d",&sum);
while(sum > 0)
{
a[i] = sum%1000;
sum /= 1000;
i++;
}
for(j = i-1; j >= 0; j--)
{
printf("%d,",a[j]);
}
printf("\n");
return;
}
请及时采纳
#include
void main()
{
int a[20],n,count=0,i;
scanf("%d",&n);
while(n)
{
a[count++]=n%1000;
n/=1000;
}
for(i=count-1;i>=0;--i)
printf("%d,",a[i]);
printf("\b \n");
}