{{|
10개 기
|}}
1 10까 구기
|}}
1 10까 곱 구기
|}}
1 2 5 6 8 10
|}}
. 값 1 64, 2 10, 3 23, 그 값 "error" |}}
1 20까 기
|}}
10개 기
|}}
~cpp #include <stdio.h> void main() { int i[10],j,k; for(j=10; j>=1; j--){ for(k=1; k<=10; k++){ i[j-k]=k;} break; } for(j=0; j<=9; j++) printf("%3d",i[j]); system("PAUSE"); }{{|
1 10까 구기
|}}
~cpp #include <stdio.h> void main() { int i; int sum=0; for(i=1; i<=10; i++){ sum+=i; } printf("1 10까 %d.",sum); system("PAUSE"); }{{|
1 10까 곱 구기
|}}
~cpp #include <stdio.h> void main() { int i; int sum=1; for(i=1; i<=10; i++){ sum=sum*i; } printf("1 10까 곱 %d.",sum); system("PAUSE"); }{{|
1 2 5 6 8 10
|}}
~cpp #include <stdio.h> void main() { int i; for(i=1; i<=10; i++){ if(i==3 || i==4 || i==7 || i==9) continue; printf("%3d",i); } system("PAUSE"); }{{|
. 값 1 64, 2 10, 3 23, 그 값 "error" |}}
~cpp #include <stdio.h> void main(){ int c; printf(" .");scanf("%d",&c); if(c==1) printf("64"); else if(c==2) printf("10"); else if(c==3) printf("23"); else printf("error"); system("PAUSE"); }{{|
1 20까 기
|}}
~cpp #include <stdio.h> void main() { int i,j; static int c[20]; for(i=1; i<=20; i++){ for(j=1; j<=i; j++){ if(i%j==0) c[i]++;} if(c[i]==2) printf("%3d",i); } system("PAUSE"); }