Warning: Use of undefined constant JMF_THEMER_MODE - assumed 'JMF_THEMER_MODE' (this will throw an Error in a future version of PHP) in /informatyka/plugins/system/djjquerymonster/djjquerymonster.php on line 210
Instrukcja warunkowa. Pole trapezu.
Drukuj

Opis programu

Kod programu:


#include <iostream>
using namespace std;

int main() {
	float a, b, h, pole;
	cout << "podaj wymiary trapezu: \n\n";
	cout << "a = "; cin >> a;	
	cout << "b = "; cin >> b;	
	cout << "h = "; cin >> h;	
	if (h==0 || a==0 || b==0) 
		cout << "ERROR!!! - wszystkie wymiary trapezu musza byc liczbami dodatnimi";
	else {
		pole=(a+b)*h/2;
		cout << "\nP = " <<  pole;
	}
		
	return 0;
}

Użycie kodu: