Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Python by rohitash ( 6 years ago )
p = int(input("Enter the number of pirates: "))
c = int(input("Enter the number of coconuts: "))
for i in range(p):
    p_coconut=int(c//p)
    M_coconut=int(c%p)
    c=(c-(int(p_coconut)+int(M_coconut)))
    print(str(p_coconut) + "for pirate #" + str(p) + "and" + str(M_coconut) + "for the monkeys")
F_coconut=int(c//p)
R_coconut=int(c%p)
print(str(F_coconut) + "for each pirate and" + str(R_coconut) + "for the monkeys")

 

Revise this Paste

Parent: 103245
Your Name: Code Language: