What problems may arise if the following program is implemen

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.)

one_tenth = 1.0 / 10.0

count = one_tenth

repeat:    

print( Count )    

Count = Count + one_tenth    

until ( Count == 1 )

Solution

If the program is implemented in the computer then, nothing will be printed as a result.

As the condition is not stisfying here. Because the Count==1 is not possible here.

one_tenth=.1 which is being given to count.

Next count=.1+.1 which is .2

and .2 is not equal to 1

Therefore, no result is printed.

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 ar

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site