The output is not correct. Something is wrong with the calculation process. Is there anything wrong with it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

The output is not correct. Something is wrong with the calculation process. Is there anything wrong with it?

#include <iostream> #include <iomanip> using namespace std; int main() { float x, sum; int i, n,p , s; cin >>p ; while (cin >> n) { for (i=0; i<n; i++){ cin >> s; sum = sum+s; } x= sum/n; cout << fixed << setprecision(2) << x << endl; } return 0; }

20th Feb 2020, 2:31 AM
Hale Julieanne
Hale Julieanne - avatar
1 Answer
0
Write your program in code then attach your code link into the question so that we can run it. Nobody wants to copy your code to run it.
19th Apr 2021, 5:19 PM
KUMAR SHANU
KUMAR SHANU - avatar