29.0k views
2 votes
Ask how many apples the user wants. Ask how many people the user will share the apples with. Find out how many apples will remain if you share the apples equally. Hint: use modulus %.

1 Answer

6 votes

Answer:

The program in Python is as follows:

apples = int(input("Apples: "))

people = int(input("People: "))

apples%=people

print("Remaining: ",apples)

Step-by-step explanation:

This gets the number of apples

apples = int(input("Apples: "))

This gets the number of people to share the apple

people = int(input("People: "))

This calculates the remaining apple after sharing the apple evenly

apples%=people

This prints the calculated remainder

print("Remaining: ",apples)

User Pablodcar
by
4.1k points