From the numbers between 1 to 30, find out how many of them are divisible by 2 and 4. When a number is divisible by 3, print "Three". When a number is divisible by 5, print "Five". When a number is divisible by both, print "ThreeFive". Otherwise, just print the number
(a) if number is divisible by 4 it implies number is divisible by 2 which implies number divisible by 2 and 4 is equivalent to number divisible by 4
from 1 to 30
4,8,12,16,20,24,28
7 number divisible by 2 and 4.
(b) code
n=input('enter number')
if rem(n,15)==0
disp('"ThreeFive"')
elseif rem(n,3)==0
disp('"Three"')
elseif rem(n,5)==0
disp('"Five"')
else
disp(n)
end
output
Get Answers For Free
Most questions answered within 1 hours.