Need help with an Algorithms course homework assignment #27: (Differs from book)
ID: 3791339 • Letter: N
Question
Need help with an Algorithms course homework assignment
#27: (Differs from book) Identify the termination condition in each of the following iterative statements.
a. while ( Count > 5 ):
...
b. repeat:
...
until ( Count == 3 )
c. while ( ( Count < 5 ) and ( Total < 9 ) ):
...
#29: (Differs from the book) What problems may arise if the following program is implemented on a computer? (Hint: Remember the problem of round-off errors associated with floating-point arithmetic.) (Hint: Review page 54)
one_tenth = 1.0 / 10.0
count = one_tenth
repeat:
print( Count )
Count = Count + one_tenth
until ( Count == 1 )
Explanation / Answer
#27
A: if value of count is less then or equal to five then program will be terminated .
count<=5
B: value of count is three then program will be terminated
count=3
C: in this case have two case
1> count value greater then or equal to five OR
2> total value is grater then then or equal to nine
if any one condition satisfied given above then program will be terminated.
like
( count>=5 or total>=9 ) in this case program will be terminated .