Skip to content

Instantly share code, notes, and snippets.

@odanado
Forked from siberiy4/work78.c
Created October 30, 2017 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odanado/b36356497f0bfb902c1e9b56150a8b41 to your computer and use it in GitHub Desktop.
Save odanado/b36356497f0bfb902c1e9b56150a8b41 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;
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