3
|
ta x va y musbat sonlarning o‘rta arifmetigi va o‘rta geometrigini hisoblaydigan Mean(x,y, Amean, Gmean) nomli void turidagi funksiya tasvirlansin(x va y – kiruvchi, Amean va Gmean-chiquvchi parametrlar bo’lib, ular haqiqiy turga tegishli). Bu funksiyadan foydalanib a, b, c, d sonlari berilganda (a,b), (a,c), (a,d) juftliklarning o‘rta arifmetiklari va o‘rta geometriklari hisoblansin.
|
#include
#include
using namespace std;
void Mean (float, float);
int main()
{
float a, b, c, d;
cout<<"a="; cin>>a;
cout<<"b="; cin>>b;
cout<<"c="; cin>>c;
cout<<"d="; cin>>d;
Mean(a,b);
Mean(a,c);
Mean(a,d);
return 0;
}
void Mean (float a, float b)
{
float m,n;
m=(a+b)/2;
n=sqrt(a*b);
cout<<"("<Download 237,33 Kb. Do'stlaringiz bilan baham: |