c언어 if문 썸네일형 리스트형 C언어 - switch문 #include int main() { int score; score = 85; if (score >= 90) printf("A"); else if (score >= 80) printf("B"); else if (score >= 70) printf("C"); else if (score >= 60) printf("D"); else printf("F"); printf("\nstop"); } 앞에서 배워 본 코드를 통해서 switch 문을 배워보도록 하자. 참고로 score 변수에 들어갈 변수는 정수(int)와 문자(char) 타입만 가능하다. *문자는 아스키코드(ASCII code)로 변환이 가능하기 때문에 정수로 인식. 하지만 문자열은 아니므로 불가능 아스키코드에 대한 내용은 다음에... #include .. 더보기 C언어 - else if, else 문 #include int main() { int s; s = 85; if (s >= 90) printf("A"); if (s >= 80) printf("B"); if (s >= 70) printf("C"); if (s >= 60) printf("D"); if (s = 90) printf("A"); else if (s >= 80) print.. 더보기 C언어 - if 조건문 우리가 저번에 사용한 구구단의 반복문 코드이다. 달라진 점을 찾아보자. #include int main() { int i, j; for (j = 2; j 더보기 이전 1 다음