Last active
October 30, 2017 14:08
-
-
Save siberiy4/7438cde2519a16ff1c7cf7fb5458724c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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