
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A set of lecture notes for a c programming course, covering conditional statements (if, else if, else) and loop statements (while, for, for-for). It includes examples and exercises.
Typology: Lecture notes
Uploaded on 09/24/2019
6 documents
1 / 24
This page cannot be seen from the preview
Don't miss anything!

















Find the root of the first-order equation
a x + b = 0, what is the solution of x?
if (a == 0 && b != 0) x =? if (a == 0 && b == 0) x =?
4
5
반복 문 for 구조
초기화(Initialization), 조건검사(conditional expression), 증감연산(increment)의 세 부분으로 구성되고 이를 세미콜론(;) 으로 구분
7
반복문 for 구조
증감 연산자
i < 5 거짓
I의 값 : i = 0 i = 0 i = 0 i = 1 i = 1 i = 1 i = 2
i = 5
8
구구단 2 단을 거꾸로 출력
10
A snail is now at the bottom of a 3 m-deep well. This snail can climb up 55 cm along the wall during the day, but slide 13 cm down during the night.How many days will it take the snail to get out of the well?
11
for 문 with array
13
변수 또는 배열의 크기를 구하는‘연산자’
14
16
17
19
Sorting numbers in an array
20
main(){ int A[10];
for (i=0; i < 10; i++) A[j] = rand() % 100;
for (i=0; i < 10; i++) for(j=i+1; j < 10; j++) if (A[i] < A[j]) { temp = A[i]; A[i]= A[j]; A[j] = temp; } }