#include <stdio.h>
int main() {
printf("Hello world!\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.535;
printf("%.2f\n", number3);
printf("----문제----\n");
int apple;
apple = 3;
float price = 1.5;
printf("사과는 %d, 가격은 %.1f",apple, price);
/* 변수 이름 규칙
1. 알파벳, 숫자, 밑줄_ 만 사용할 수 있다
2. 숫자로 시작할 수 없다
3. C언어의 키워드는 사용할 수 없다 */
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: