English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Write a C++ program that reads in three floationg point numbers from the keyboard and the finds the arithmetic, harmonic, and geometric mean. PLEASE HELP !!!!!!! I M STUCK !!!!!!!!!!!!!!!1

2007-02-07 00:27:06 · 1 answers · asked by texas87x 1 in Computers & Internet Programming & Design

1 answers

#include
#include
using namespace std;

int main(){
float a1,a2,a3,h,a,g,c,y;

while(true) {

system("cls");

cout <<"\nEnter the first number:";
cin >> a1;

cout <<"\nEnter the second:";
cin >> a2;

cout <<"\nEnter the third:";
cin >> a3;

c=a1*a2*a3;

a=(a1+a2+a3)/3.0;

h=(3*c)/(a1*a2+a1*a3+a2*a3);

y=1.0/3.0;

g=pow(c,y);

cout << "\nArithmetic mean : " << a;
cout << "\nGeometric mean : " << g;
cout << "\nHarmonic mean : " << h;
cout << endl << endl;
system("pause");
}
}

2007-02-07 01:33:15 · answer #1 · answered by iyiogrenci 6 · 0 0

fedest.com, questions and answers