Hey
I'm currently stuck on a problem. I have to create a program that reads the input of two numbers and works out their Arithmetic/Geometric/Harmonic mean. It then calculates which mean is the highest and displays it on the screen.
This is what I have so far...
Code:#include <math.h> int main() { Double num1 Double num2 Double ari Double geo Double har printf("enter num1"); scanf ("%d%*C" , &num1), printf("enter num2"); scanf ("%d%*C" , &num2); ari = ((num1+num2)/2); printf("Arithmetic Mean =",ari); printf("enter num1"); scanf ("%d%*C" , &num1), printf("enter num2"); scanf ("%d%*C" , &num2); geo = ((num1*num2) printf("enter num1"); scanf ("%d%*C" , &num1), printf("enter num2"); scanf ("%d%*C" , &num2); har =
Is this correct so far? Is there a way I can make it shorter? For example, do I actually need printf/scanf before each mean?
I also have no idea how to write the Harmoic code :/
Thanks 4 any help![]()



LinkBack URL
About LinkBacks





