Launa 2023. 6. 15. 20:44

교수님이랑 같이 했던 예제

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main(void)
{
    //1.변수선언
    int width, height;
 
    //2.데이터 입력
    printf("Enter a width:");
    scanf("%d"&width);
    printf("Enter a height:");
    scanf("%d"&height);
 
    //3. 처리 및 출력
    printf("가로는%d 세로는 %d이다\n", width, height);
    printf("넓이는 %d\n", width*height);
    return 0;
}
cs

scan문 배우기