Click here to Skip to main content
15,886,002 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I tried to submit this problem but i am getting runtime error.Where am i wrong?

What I have tried:

Deposit = float(input())
n = int(input())
i = 0
while i <=n:
    Withdraw = int(input())
    if Withdraw % 5 == 0 and (Withdraw+0.50)<= Deposit:
        Deposit = Deposit - (Withdraw + 0.50)
        print("%.2f"%Deposit)
    elif Withdraw % 5 != 0 and (Withdraw+0.50) <= Deposit:
        print("%.2f"%Deposit)
    elif Withdraw > Deposit:
        print("%.2f"%Deposit)
Posted
Updated 20-May-21 10:15am

1 solution

Since you don't modify i or n within your while loop, how do you think it ever ends?
 
Share this answer
 
Comments
CPallini 21-May-21 2:03am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900