0
how to write a c program to calculate the average of set of n numbers
5 odpowiedzi
+ 1
1) set how many numbers you want to consider (n).
2) set sum = 0
3) printf an instruction to tell you to enter the numbers
4) create a for-loop (0....n), where you enter these numbers. In the same loop you also compute the sum (sum += last entered n).
5) After the loop calculate the average (= sum / n)
6) print the value of the average.
Use all that directy in the main function. If you have further questions, ask them!
I hope that helps a little!
+ 5
Where is your attempt?
0
Attempt mean I want set of n numbers
0
❤❤❤❤❤❤❤❤❤❤❤❤❤
0
If we want to terminate that program when input is -1 what we should do?