0

how to write a c program to calculate the average of set of n numbers

5th Jul 2020, 5:32 AM
narthana wickramasinghe
narthana wickramasinghe - avatar
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!
5th Jul 2020, 7:00 AM
yyy
+ 5
Where is your attempt?
5th Jul 2020, 5:34 AM
Nilesh
Nilesh - avatar
0
Attempt mean I want set of n numbers
5th Jul 2020, 5:34 AM
narthana wickramasinghe
narthana wickramasinghe - avatar
0
❤❤❤❤❤❤❤❤❤❤❤❤❤
5th Jul 2020, 7:02 AM
narthana wickramasinghe
narthana wickramasinghe - avatar
0
If we want to terminate that program when input is -1 what we should do?
6th Jul 2020, 1:07 AM
narthana wickramasinghe
narthana wickramasinghe - avatar