int main(void) {
int age;
double height;
char grade;
printf("Input your grade : \n");
scanf("%c", &grade);
printf("Your grade is %c\n", grade);
printf("Input age and height\n");
scanf("%d%lf", &age, &height);
printf("age is %d height is %.1lfcm\n", age, height);
}
이렇게 코딩을 하면 출력이
Input your grade : A Your grade is A Input age and height 20 180 age is 20 height is 180.0cm 이렇게 나오는데
int main(void) {
int age;
double height;
char grade;
printf("Input age and height\n");
scanf("%d%lf", &age, &height);
printf("age is %d height is %.1lfcm\n", age, height);
printf("Input your grade : \n");
scanf("%c", &grade);
printf("Your grade is %c\n", grade);
}
이렇게 하면 출력값이
Input age and height 20 180 age is 20 height is 180.0cm Input your grade : Your grade is 이렇게 나옵니다. 순서에 따라 왜 이런가요?