Cho đáy B và chiều cao H của hình bình hành. Tính diện tích.
Ví dụ
Đầu vào
B = 20, H = 15
Đầu ra
300
Công thức
Area = base * height
Chương trình C++
#include <iostream>
using namespace std;
float calcParallelogramArea(float B, float H) {
return B * H;
}
int main() {
float B = 20, H = 15;
cout << "The area of parallelogram with base " << B << " and height " << H << " is " << calcParallelogramArea(B, H);
return 0;
}
Kết quả
The area of parallelogram with base 20 and height 15 is 300