chapter 2) 정수와 실수의 출
#include int main(void){ printf("%d\n", 10); printf("%lf\n", 3.4); printf("%.1lf\n", 3.45); printf("%.10lf\n", 3.4); printf("%d +%d = %d\n", 10,20,10+20); printf("%.1lf-%.1lf = %.1lf\n", 3.4, 1.2, 3.4-1.2); return 0; } 코드 설명 1. main() 함수 1-1. printf() 문을 6개 사용하여 각각 정수, 실수, 실수 첫째 자리까지, 실수 10번째 자리까지, 정수 + 정수 = 정수, 실수 첫째 자리 - 실수 첫째 자리 = 실수 첫째 자리 출력 2. 반환문 (return) 사용
2024. 6. 1.