Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

For the last portion of this assignment (question 5) its asking to do the following

For the last portion of this assignment (question 5) its asking to do the following:

Modify the code to allow the user to enter any number of pairs and calculate the average. In other words, the user could enter any number of pairs as long as the weight is positive. (Hint: You can prompt the user for how many they want to enter. Or; you could use a sentinel value to trigger when the user has completed entering values). sentinel value question.png

sentinel value question.png
C N
REED120/PunctualStylishExtension /
invite 8*
run
share
+ new repl
my repls 28 talk
JREED120 10) –
Files 1 1
munc
https:/PunctualStylishExtension jreed120.repl run
14
sun – 8:
g veraion 7.0.0-3-ubuntu0.18.04.1 (tage/RELEASE 700/Call
BVR – 0.0;
17
ugh to Input values
while (count < 4) {
Enter a value and ata weight: 21
32.5
18
19
printf ("Enter a value and its weight: ");
nter a value and its weight: 902
20
Xf for flout
ter a value and its weight: 8
21
scant("Alf 21f", &value, Sweight);
72
if (weight >- 0) {
8.23
Enter a value and its weight: 5.4
23
cuna – cum + wright;
24
sun – sun I value . weight;
average is 168.432910
25
count – count + 1;
26
27
printf("Weight must be positive\"):
29
J // and if weight ok
} // and reading input values and weights
31
// Calculate avg if sum is not 0
32
ave – sun / sum;
33
Printf ("average is *If\m " . avg ):
return e;
} // end main
 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"