Prepare a flowchart and an algorithm to check whether a given number is divisible by 7,
Answers
Answered by
1
Answer:
bawisjsmmajskalsjkskskhe
z
Attachments:
Answered by
0
Logic:
- If the mod of any num ( lets assume as n ) is 0, than n is divisible by 7. Or n is the multiple of 7.
Equation: n % 7 == 0
*Modulus operator returns the remainder of the calculation.
∵ 12 % 2 is kinda the same as 12 / 2, the only difference is % will return 0 instead of 6.
Let me make it more clear for you
20 % 4 will return 0 ( stating that 20 is completely divisible by 4 ).
Q = 5, R = 0.
And,
20 / 4 will return 5 ( / operator returns the quotient )
Algorithm:
- Start.
- Accept n.
- if n % 7 = 0,
- Print "The given number is divisible by 7.
- else
- Print "The provided number is not divisible by 7".
- End.
Flowchart:
Attached in the attachments...
Hope this helps you <3
Attachments:
Similar questions