Draw a flow chart to input a natural
number, such as 997, and determine
whether or not it is a multiple of 3.
Answers
Answered by
0
This is rather easy to attain through programming.
Here it is asked to determine if 997 is a multiple of 3 or not. What needs to be used for this purpose is the "modulo operator" (denoted by '%' symbol which also works as the operator symbol). To understand how it works, x%y = k means that when x is divided by y, a remainder of k is left, i.e. in other words, x = ny + k where n has an Integral value.
Hence, to determine whether 997 or rather any number is a multiple of 3 or any other number, the condition that needs to be satisfied is that first_num%second_num = 0 i.e. there is no remainder and hence the first number is a multiple of the second.
However, this condition does not hold to true for the case mentioned in the problem above since,
997%3 = 1 and the condition for being a multiple fails.
Here it is asked to determine if 997 is a multiple of 3 or not. What needs to be used for this purpose is the "modulo operator" (denoted by '%' symbol which also works as the operator symbol). To understand how it works, x%y = k means that when x is divided by y, a remainder of k is left, i.e. in other words, x = ny + k where n has an Integral value.
Hence, to determine whether 997 or rather any number is a multiple of 3 or any other number, the condition that needs to be satisfied is that first_num%second_num = 0 i.e. there is no remainder and hence the first number is a multiple of the second.
However, this condition does not hold to true for the case mentioned in the problem above since,
997%3 = 1 and the condition for being a multiple fails.
Similar questions