//課題021
//上底と下底と高さから台形の面積を表示するプログラムに負の数が入力されたらワーニングを出すプログラムです
//             2026.06.10 24A2021 伊藤宗兼
#include <stdio.h>

int main(void) {
	int upperbase;  //上底
	int bottombase; //下底
	int height;     //高さ
	int area;       //面積

	printf("上底の数を入力してください。\n");
	scanf("%d", &upperbase);
	if (upperbase < 0) {
		printf("上底が負の長さで計算しますよ。\n");
	}

	printf("下底の数を入力してください。\n");
	scanf("%d", &bottombase);
	if (bottombase < 0) {
		printf("下底が負の長さで計算しますよ。\n");
	}

	printf("高さの数を入力してください。\n");
	scanf("%d", &height);
	if (height < 0) {
		printf("高さが負の長さで計算しますよ。\n");
	}

	area = ((upperbase + bottombase) * height) / 2;
	printf("上底が%d、下底が%d、高さが%dの面積は%dです。\n", upperbase, bottombase, height, area);
	return 0;
}
