์ ์ํ ๋ณ์๋ %d
์ค์ํ ๋ณ์๋ %f
๋ฌธ์ ํ๋๋ %c
๋ฌธ์์ด์ %s
๋ฌธ์์ด์ (%s, str , sizeof(str))
#include <stdio.h>
int main()
{
//์ ์ํ ๋ณ์
/*int age = 12;
printf("%d\n",age);
age = 13;
printf("%d\n", age);*/
//์ค์ํ ๋ณ์
/*float f = 46.5f;
printf("%.2f\n", f);
double d = 4.428;
printf("%.2lf\n", d);
const int YEAR = 2000;
printf("ํ์ด๋ ๋
๋ : %d\n", YEAR);*/
/*int add = 3 + 7;
printf("3+7 = %d\n", add);
printf("%d + %d = %d\n", 30, 79, 30 + 79);
int input;
printf("๊ฐ์ ์
๋ ฅํ์ธ์ : ");
scanf_s("%d", &input);
printf("์
๋ ฅ๊ฐ : %d\n", input);*/
/*int one, two, three;
printf("3๊ฐ์ ์ ์๋ฅผ ์
๋ ฅํ์ธ์: ");
scanf_s("%d %d %d", &one, &two, &three);
printf("์ฒซ ๋ฒ์งธ ๊ฐ : %d\n ", one);
printf("๋ ๋ฒ์งธ ๊ฐ : %d\n ", two);
printf("์ธ ๋ฒ์งธ ๊ฐ : %d\n ", three);
char a = 'q';
printf("%c\n", a);
char str[256];
scanf_s("%s", str, sizeof(str));
printf("%s\n", str);*/
//ํ๋ก์ ํธ
//๊ฒฝ์ฐฐ๊ด์ด ๋ฒ์ฃ์์ ์ ๋ณด๋ฅผ ์
์
char name[256];
printf("์ด๋ฆ์ด ๋ญ์์? : ");
scanf_s("%s", name, sizeof(name));
int age;
printf("๋ช์ด์ด์์? : ");
scanf_s("%d", &age);
float weight;
printf("๋ชkg์์?: ");
scanf_s("%f", &weight);
double height;
printf("ํค๊ฐ ๋ช cm์์? : ");
scanf_s("%lf", &height);
char what[256];
printf("๋ฌด์จ ์ฃ๋ฅผ ์ง์์ด์? : ");
scanf_s("%s", what, sizeof(what));
//์กฐ์ฌ๋ด์ฉ์ถ๋ ฅ
printf("\n\n~~~๋ฒ์ฃ์ ์ ๋ณด~~~\n\n");
printf("์ด๋ฆ : %s\n", name);
printf("๋์ด : %d\n", age);
printf("๋ชธ๋ฌด๊ฒ : %.2f\n", weight);
printf("ํค : %.2lf\n", height);
printf("๋ฒ์ฃ๋ช
: % s\n", what);
return 0;
}
'๐ฉโ๐ป ์๊ณ ๋ฆฌ์ฆ > ๐ C' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋น๋ฏธ๋์ด ํผ๊ณตํ์ต๋จ_ํผ๊ณตC] 4์ฃผ์ฐจ ์คํฐ๋ ch7 (0) | 2024.01.28 |
---|---|
[ํ๋น๋ฏธ๋์ด ํผ๊ณตํ์ต๋จ_ํผ๊ณตC] 3์ฃผ์ฐจ ์คํฐ๋ ch5~ch6 (0) | 2024.01.21 |
[ํ๋น๋ฏธ๋์ด ํผ๊ณตํ์ต๋จ_ํผ๊ณตC] 2์ฃผ์ฐจ ์คํฐ๋ ch3~ch4 (0) | 2024.01.14 |
[ํ๋น๋ฏธ๋์ด ํผ๊ณตํ์ต๋จ_ํผ๊ณตC] 1์ฃผ์ฐจ ์คํฐ๋ ch1 ~ ch2 (0) | 2024.01.03 |
[๋๋์ฝ๋ฉ C์ธ์ด ๋ฌด๋ฃ๊ฐ์] ํ๋ก์ ํธ 2 (0) | 2023.07.27 |