Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main() {
- /*
- int age = a;
- float height = h, weight = w;
- 정수(int)를 담을 수 있는 'age'라는 변수(상자)에 a를 집어 넣는다 -> a가 뭔데?
- 실수(float)를 담을 수 있는 'height'라는 변수(상자)에 h를 집어 넣는다 -> h가 뭔데?
- 실수(float)를 담을 수 있는 'weight'라는 변수(상자)에 w를 집어 넣는다 -> w가 뭔데?
- */
- int age;
- float height, weight;
- printf("Enter your age : ");
- //scanf("%d", &a); 함수 이름이 age 이므로 &age
- scanf("%d", &age);
- printf("Enter your height in cm : ");
- //scanf("%f", &h); 함수 이름이 height이므로 &height
- scanf("%f", &height);
- printf("Enter your weight in kg : ");
- //scanf("%d", %w);
- /*
- * 1. 함수 이름이 weight이므로 &weight
- * 2. %가 아닌 &
- * 3. 실수를 입력 받으므로 %f
- */
- scanf("%f", &weight);
- //printf(66+(13.8*weight)+)5.0*height-6.8*age);
- /*
- * 1. 실수를 출력할 예정이고, 소수점 둘째 자리까지만 출력해야 하므로 %0.2f를 추가해야함
- * 2. ~~)5.0 -> 괄호 두번
- */
- printf("%0.2f", 66 + 13.8 * weight + 5.0 * height - 6.8 * age);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement