본문 바로가기
IT/프로그래밍

c언어 연습 (문제풀이 중심의) 1장 문제풀이 해설

by nutrient 2021. 4. 29.
728x90
728x170

c언어 연습 (문제풀이 중심의) 1장 해설 및 답지

 

1-1. 결과 출력
#include <stdio.h>
 
int main(void) {
 
    printf("C program을 배웁시다.");
 
    return 0;
}
 

1-2. 서식 지정자를 사용해서 결과 출력
#include <stdio.h>
 
int main(void) {
 
    printf("%f를 반올림하면 %d입니다.", 34.5, 35);
 
    return 0;
}
 

1-3. 서식 지정자를 사용해서 결과 출력
#include <stdio.h>
 
int main(void) {
 
    printf("나의 이름은 %s입니다.", "홍길동");
 
    return 0;
}
 

1-4. 서식 지정자를 사용해서 결과 출력
#include <stdio.h>
 
int main(void) {
 
    printf("알파벳의 첫 글자는 %c이고 끝 글자는 %c입니다.", 'A', 'Z');
 
    return 0;
}
 

1-5. 2행에 걸쳐 결과 출력
#include <stdio.h>
 
int main(void) {
 
    printf("C 언어\n");
    printf("BASIC 언어");
 
    return 0;
}
 

1-6. 개행 문자를 이용해 결과 출력
#include <stdio.h>
 
int main(void) {
 
    printf("C언어\n\nBASIC 언어");
 
    return 0;
}

 

 

728x90
그리드형

댓글