Sherlock is a great detective but he is weak in maths. On one day Sherlock wants to divide N apples into M people but he is not sure whether he can divide them equally or to help Sherlock to solve the problem. Input User Task: Since this will be a functional problem, you don't have to take input. You just have to complete the function Help() that takes integers N and M as arguments.
Output-Return 1 if is possible to divide N apple among M people else return 0.
Find java program
Answers
Answered by
0
Answer is in the attachment please mark me as brainlists
Attachments:
Answered by
10
Given below is the program for the required function in Python programming language.
Explanation:
- The given problem can be solved using the '%' operator which gives the remainder from division of two integers the values.
- If the remainder is zero then the number of apples can be equally divided among a given number of people.
- PROGRAM:
- def Help(N, M):
- if(N%M==0):
- print("The given number of apples are can equally divided among the given number of people\n")
- else:
- print("The given number of apples are cannot be equally divided among the given number of people\n")
Similar questions