iOS/C
[C언어] 사다리꼴 넓이 구하기
CoCoE
2021. 5. 21. 14:16
int top;
int bottom;
int height;
printf("윗변: ");
scanf("%d", &top);
printf("밑변: ");
scanf("%d", &bottom);
printf("높이: ");
scanf("%d", &height);
float width;
width = (top + bottom) * height/2.0;
printf("윗변(%d), 밑변(%d), 높이(%d)의 사다리꼴 넓이는 %.3f입니다", top, bottom, height, width);
사다리꼴의 넓이를 구해봤습니다.
감사합니다.