9/3/수 - C언어

kimseunghoo · September 03, 2025
#include <stdio.h>

int main() {
    printf("dirty oh oh!\n");
    printf("Hello\n");
    printf("Hello\n");
    //printf("Hello\n");
    // 주석 : 컴퓨터가 인식하지 않는 부분
    printf("Hello world!\n");
    /* 여러 줄 주석
    printf("Hello world!\n");
    printf("Hello world!\n");
    printf("Hello world!\n");
    printf("Hello world!\n"); */

    //정수형 변수와 실수형 변수
    // 변수 : 값을 저장하는 상자
    // 정수 int %d : 뒤에 소수점이 없는 숫자
    // 실수 float %f : 뒤에 소수점이 있는 숫자

    /* 변수 만드는 방법
        자료형 변수이름 = 값;
    */

    int number1 = 93;
    printf("%d\n",number1);

    float number2 = 3.14;
    printf("%f\n",number2);

    float number3;
    number3 = 2.5345776;  
    printf ("%.2f\n", number3);

    printf("---문제---\n");
    
    int apple = 3;

    float price;
    price = 1.5;
    
    printf("사과는 %d ,가격은 %f ",apple,price);

    
   

    return 0;
}
Output

Comments

Please sign up or log in to contribute to the discussion.