7.2.. Za učitane a i b izračunati z prema izrazu z := min(a2, b2).
Opis programa:
Listing programa:
// 07211043
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
double a,b,min;
cout << "Unesite dva broja: "cout << endl;
cin>>a>>b;
if ((a*a) < (b*b))
min=(a*a);
else
min=(b*b);
cout << "Od brojeva: "cout << acout << " i "cout << bcout << endl;
cout << "Manji kvadrat je: "cout << mincout << endl;
return 0;
}
II Varijanta
// 07211043
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
double a,b,min;
cout << "Unesite dva broja: "cout << endl;
cin>>a>>b;
min = (a*a);
if ((b*b) < min)
min=(b*b);
cout << "Od brojeva: "cout << acout << " i "cout << bcout << endl;
cout << "Manji kvadrat je: "cout << mincout << endl;
return 0;
}
Ispis na ekranu:
Index
|
|