-
-
Save odanado/b36356497f0bfb902c1e9b56150a8b41 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; | |
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