.

Thursday, January 3, 2019

It 210 Week 4 Check Point 1

1 arrest Count historic period As Integer 2 Decl ar Sumold years As Float 3 Declare fester As Float 4 Declare ParticipantAverage As Float 5 tack together CountAge 0 6 Set SumAge 0 7 Write accede one and only(a) age. Enter 0 when done. 8 excitant Age 9 While Age > 0 10 Set CountAge = CountAge + 1 11 Set SumAge = SumAge + Age 12 Write Enter an participant age. Enter 0 when done. 13 Input Age 14 End While 15 Set ParticipantAverage = SumAge / CountAge 16 Write Your age average is + AgeAverage * hunts 16 harbour and initialize the variables. Line 7 asks for the starting age and also explains that when you are finished introduction the age for a limited set, you arse end by entryway 0. * The first Age is input on line 8. * Lines 914 are the loop. It sums the age entered and it keeps count of how many an(prenominal) ages were entered. * In Line 10 keeps track of how many ages are entered. For each pass through and through the loop, CountAge is incremented by 1. If yo u enter triple ages sooner you end the program by entering 0, the loop lead execute three times and CountAge will be bear on to 3.If you enter 5 ages, the loop will execute 5 times and CountAge will be equal to 5. * Line 11 keeps a sum of all the participant ages. To compute your participant average age, you mustiness divide the sum of all your participants ages by the number of participants, so lines 10 and 11 keep track of the information we conduct to compute the average at the end. * Lines 12 and 13 ask the user for the following(a) participants age and gets the next input. Here, if youre done, you can enter a 0. * Line 14 ends the loop when the user enters a zero. * Line 15 computes the average and line 16 displays that average.

No comments:

Post a Comment