Skip to content

Instantly share code, notes, and snippets.

@siberiy4
Last active October 30, 2017 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save siberiy4/7438cde2519a16ff1c7cf7fb5458724c to your computer and use it in GitHub Desktop.
Save siberiy4/7438cde2519a16ff1c7cf7fb5458724c to your computer and use it in GitHub Desktop.
#include<stdio.h>
int main(void){
int a,b,c=1, i, j, e, f, p, d=0;
printf("桁区切りする値の入力:");
scanf("%d",&a);
b=a;
f=a;
while(b>0){
b=b/10;
c=c*10;
d=d+1;
}
e=d-(d/3)*3;
c=c/10;
for(i=0;i<d/3+1;i++){
if(i>0){e=3;}
for(j=0;j<e;j++){
f=a/c;
printf("%d",f%10);
c=c/10;
}
if(e&&c) printf(",");
}
printf("\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment