๋ฐ˜์‘ํ˜•

ETC๐Ÿงท 19

(์—ดํ˜ˆ C ํ”„๋กœ๊ทธ๋ž˜๋ฐ) ์—ฐ์Šต๋ฌธ์ œ ํ’€์ด chapter-08(1)

๋ฌธ์ œ 08-1 1. 1์ด์ƒ 100๋ฏธ๋งŒ ์ •์ˆ˜์ค‘ 7๊ณผ 9์˜ ๋ฐฐ์ˆ˜์ถœ๋ ฅ, ๊ฐ™์€์ˆ˜๋Š” 1๋ฒˆ๋งŒ์ถœ๋ ฅ 1 2 3 4 5 6 7 8 9 10 #include int main() { for(int i=1;i= b) printf("%d - %d = %d",a,b,a-b); else printf("%d - %d = %d",b,a,b-a); } Colored by Color Scripter cs 3. ํ•™์ƒ ์ „์ฒด ํ‰๊ท ์— ๋Œ€ํ•œ ํ•™์ ์„ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ. 90์ด์ƒ A, 80์ด์ƒ B, 70์ด์ƒ C, 50์ด์ƒ D, ๋ฏธ๋งŒ์€ F, ๊ตญ์–ด,์˜์–ด,์ˆ˜ํ•™ ์ ์ˆ˜๋ฅผ ์ž…๋ ฅ๋ฐ›์•„์„œ ํ‰๊ท ์„ ๊ตฌํ•ด ํ•™์ ์„ ์ถœ๋ ฅ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 #include int..

ETC๐Ÿงท 2019.12.17

(์—ดํ˜ˆ C ํ”„๋กœ๊ทธ๋ž˜๋ฐ) ์—ฐ์Šต๋ฌธ์ œ ํ’€์ด chapter-07(3)

๋ฌธ์ œ 07-3 1.์˜ˆ์ œ๋ฅผ while ๊ธฐ๋ฐ˜์œผ๋กœ ๊ตฌํ˜„ํ•˜๊ธฐ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #include int main() { int total = 0, num = 1; while(num!=0) { printf("์ •์ˆ˜์ž…๋ ฅ"); scanf("%d",&num); total += num; } printf("ํ•ฉ๊ณ„ %d \n",total); } cs 2.0์ด์ƒ 100์ดํ•˜์˜ ์ •์ˆ˜์ค‘์—์„œ ์ง์ˆ˜์˜ํ•ฉ์„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ ๊ตฌํ˜„. do~while๋ฌธ ๊ธฐ๋ฐ˜์œผ๋กœ ๊ฒฐ๊ณผ๋Š” 2550์ด๋‹ค. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #include int main() { int i=0; int result =0; do { result += i; i=i+2; }while(i do~w..

ETC๐Ÿงท 2019.12.16

(์—ดํ˜ˆ C ํ”„๋กœ๊ทธ๋ž˜๋ฐ) ์—ฐ์Šต๋ฌธ์ œ ํ’€์ด chapter-07(2)

๋ฌธ์ œ 07-2 1. 5๊ฐœ์˜ ์ •์ˆ˜๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ ํ•ฉ์„ ๊ตฌํ•œ๋‹ค. ์ •์ˆ˜๋Š” ๋ฐ˜๋“œ์‹œ 1์ด์ƒ์ด๊ณ  1๋ฏธ๋งŒ์ผ ๊ฒฝ์šฐ ์žฌ์ž…๋ ฅ์„ ์š”๊ตฌํ•œ๋‹ค. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #include int main() { int i = 0; int a; int result = 0; while(i

ETC๐Ÿงท 2019.12.15

(์—ดํ˜ˆ C ํ”„๋กœ๊ทธ๋ž˜๋ฐ) ์—ฐ์Šต๋ฌธ์ œ ํ’€์ด chapter-05

๋ฌธ์ œ 05-1 1. x, y ๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ ์ง์‚ฌ๊ฐํ˜•์˜ ๋„“์ด ๊ตฌํ•˜๊ธฐ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #include int main() { int x1,y1,x2,y2; int result; printf("์ขŒ์ƒ๋‹จ์˜ ์ขŒํ‘œ๋ฅผ ์ž…๋ ฅ ํ•˜์„ธ์š”: "); scanf("%d %d",&x1,&y1); printf("์šฐ์ƒ๋‹จ์˜ ์ขŒํ‘œ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š” : "); scanf("%d %d",&x2,&y2); result = (x2-x1)*(y2-y1); printf("์ขŒ์ƒ๋‹จ x:%d y:%d\n",x1,y1); printf("์šฐ์ƒ๋‹จ x:%d y:%d\n",x2,y2); printf("๋„“์ด : %d ",result); } Colored by Color Scripter cs 2. ๋‘๊ฐœ์˜ ์‹ค์ˆ˜๋ฅผ ์ž…๋ ฅ..

ETC๐Ÿงท 2019.12.15

(์—ดํ˜ˆ C ํ”„๋กœ๊ทธ๋ž˜๋ฐ) ์—ฐ์Šต๋ฌธ์ œ ํ’€์ด chapter-04

๋ฌธ์ œ 04-4[๋น„ํŠธ์—ฐ์‚ฐ์˜ ์ดํ•ด] 1.์ž…๋ ฅ๋ฐ›์€ ์ •์ˆ˜๊ฐ’์˜ ๋ถ€ํ˜ธ๋ฅผ ๋ฐ”๊ฟ” ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑ 1 2 3 4 5 6 7 8 9 10 11 12 13 #include int main() { int num; printf("์ •์ˆ˜๊ฐ’์„ ์ž…๋ ฅํ•˜์„ธ์š” : "); scanf("%d",&num); num = ~num+1; //2์˜๋ณด์ˆ˜๋กœ ๋ณ€ํ™˜ printf("๋ณด์ˆ˜๊ฐ’์€ %d์ž…๋‹ˆ๋‹ค\n.",num); } cs 2.์—ฐ์‚ฐ๊ฒฐ๊ณผ๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑ(๋น„ํŠธ์—ฐ์‚ฐ ์‚ฌ์šฉ) ex) 3x8/4 1 2 3 4 5 6 7 8 9 10 11 #include int main() { int a=3; a = a 2; printf("%d",a); } cs

ETC๐Ÿงท 2019.12.15

(์—ดํ˜ˆ C ํ”„๋กœ๊ทธ๋ž˜๋ฐ) ์—ฐ์Šต๋ฌธ์ œ ํ’€์ด chapter-03

๋ฌธ์ œ 03-1 ๋ฌธ์ œ1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #include int main() { //๋ฌธ์ œ1 int a = 0; int b = 0; printf("๋‘๊ฐœ์˜ ์ •์ˆ˜๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”.\n"); scanf("%d",&a); scanf("%d",&b); printf("%d - %d = %d\n",a,b,a-b); printf("%d x %d = %d\n",a,b,a*b); } ๋ฌธ์ œ2 1 2 3 4 5 6 7 8 9 10 11 12 13 #include int main() { //๋ฌธ์ œ1 int num1,num2,num3; printf("์„ธ๊ฐœ์˜ ์ •์ˆ˜๋ฅผ ์ˆœ์„œ๋Œ€๋กœ ์ž…๋ ฅํ•˜์„ธ์š”.\n"); scanf("%d",&num1); scanf("%d",&num2); scanf("%..

ETC๐Ÿงท 2019.12.14

(์—ดํ˜ˆ C ํ”„๋กœ๊ทธ๋ž˜๋ฐ) ์—ฐ์Šต๋ฌธ์ œ ํ’€์ด chapter-02

๋ฌธ์ œ 02-1 1.๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ˜•ํƒœ๋กœ ๋ณธ์ธ์˜ ์ด๋ฆ„์„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•ด๋ณด์ž ๋‹จ,printf ํ•จ์ˆ˜๋Š” ํ•œ๋ฒˆ๋งŒ ํ˜ธ์ถœํ•ด์•ผํ•œ๋‹ค. 2.๋ณธ์ธ์˜ ์ด๋ฆ„,์ฃผ์†Œ,์ „ํ™”๋ฒˆํ˜ธ๋ฅผ ๋ชจ๋‹ˆํ„ฐ์— ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑ. ์ด3๋ฒˆ์˜ printfํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ๋ณด๊ธฐ์ข‹๊ฒŒ ๋‹ค๋“ฌ๋Š”๋‹ค. 1 2 3 4 5 6 7 8 9 10 11 12 13 #include int main() { //๋ฌธ์ œ1 printf("ํ™๊ธธ๋™\nํ™ ๊ธธ ๋™\nํ™ ๊ธธ ๋™\n"); //๋ฌธ์ œ2 printf("์ด๋ฆ„ : xxx\n"); printf("์ฃผ์†Œ : xx์‹œ xx๊ตฌ xx๋™ xx์•„ํŒŒํŠธ\n"); printf("์ „ํ™”๋ฒˆํ˜ธ: 010-xxx-xxxx\n"); } Colored by Color Scripter cs ๋ฌธ์ œ 02-2 1.๋‹ค์Œ ์ถœ๋ ฅ๊ฒฐ๊ณผ๋ฅผ ๋ณด์ด๋„๋ก ์˜ˆ์ œ๋ฅผ ์ž‘์„ฑ, %d๋ฅผ ์ด์šฉํ•˜์—ฌ ์ถœ..

ETC๐Ÿงท 2019.12.14
๋ฐ˜์‘ํ˜•