I am trying to create a program in C that calculates the Arithmetic Mean, Geometric Mean, Harmonic Mean, and Standard Deviation (code not shown in picture). After running the program and entering the five integers, the program returns Geometric Mean = nan and Harmonic Mean = inf. I believe the issue has to do with the fact that the multiplication in the operations creates too large of integers for the program to store, but I’m not sure how to correct this for the program to run properly.
Also, when I input the operation for standard deviation, it says that the (^) binary operator cannot be used in double, but I need the double format to be able to get a floating point result since the input values need to be integers.
Thanks in advance
x A 2 CMakeLists.txt main.c #include #include math.h> oint main() { int n1 , n2 , n3 , n4, n5 ; M/Defines 5 variables as integers to be input by user, double AM , GM, HM, SD; TI Defines variables as doubles for Arithmetic Mean , Geometric Mean, Harmonic Mean , and Standard Deviation rintf(“Please Enter Five Integersn “): I/Prompts user to enter five integers scantf(“21” “1” “21” “i” “i”, Sni, An2, &n3, An4, &n5 ): I/Defines values read from keyboard as integers. AM (double) (ni + n2+ n3+ n4+ n5)/5; I/Defines operation to calculate Arithmetic Means GM = pow(nlan2n3 nzen4%n5 , 0.2): I/Defines operation to calculate Geometric Mean HMS (double) 5/((1/n2) + (1/n2) + (1/n3) + (1/n4) + (1/n5): T/Defines operation to calculate Harmonic Mean printf (‘Data: In hin in in in in “, nin2, n3 , no, n5 ): I/Displays data entered by user printf (“Results: In Arithmetic Mean B 6.4fn Geometric Mean B 6.4n Harmonic Mean = 6.4gn “, AM, GM, HM): ;1/Displays results of return 0;