Odpowiedź:
#include <iostream>
using namespace std;
int main()
{
int x,pole,obw;
cout<<"podaj x: ";
cin>>x;
if(x>0){
pole =x*x;
obw = 4*x;
cout<<"pole wynosi: "<<pole<<endl;
cout<<"obwod wynosi: "<<obw<<endl;
}
else cout<<"bledna wartosc";
return 0;
}
Wyjaśnienie: