fork download
  1. #include <iostream>
  2. #include<cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. double n , m , a_m , g_m , h_m ;
  7. cout<<"please enter n"<<endl;
  8. cin>>n;
  9. cout<<"please enter m"<<endl;
  10. cin>>m;
  11. a_m = (m+n)/2;
  12. cout<<"Arthemtic mean value is "<<a_m<<endl;
  13. g_m = sqrt(m*n);
  14. cout<<"Geometric mean value is "<<g_m<<endl;
  15. h_m= ((1/m) + (1/n))/2;
  16. cout<<"Harmonic mean value is "<<h_m<<endl;
  17. return 0;
  18. }
Success #stdin #stdout 0s 4268KB
stdin
5
10
stdout
please enter n
please enter m
Arthemtic mean value is 7.5
Geometric mean value is 7.07107
Harmonic mean value is 0.15