Question

From the numbers between 1 to 30, find out how many of them are divisible by...

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

Homework Answers

Answer #1

(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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
How many numbers are there from 1 to 1050 which are not divisible by the digits...
How many numbers are there from 1 to 1050 which are not divisible by the digits 3, 5, and 7?
a) How many of the integers from 1 to 1000 are divisible by at least one...
a) How many of the integers from 1 to 1000 are divisible by at least one of 3, 5, and 7? b)(When the expression (A+ a)(B + b)(C + c)(D + d)(E + e) is multiplied out, how many terms will have three uppercase letters? c) How many ways are there to pick a combination of k things from {1, 2,...,n} if the elements 1 and 2 cannot both be picked? d) 2 How many ways are there to put...
How many 9-digit numbers (that is numbers between 100,000,000 and 999,999,999) a) Are even? (type a...
How many 9-digit numbers (that is numbers between 100,000,000 and 999,999,999) a) Are even? (type a whole number) b) Are divisible by 5? (type a whole number) c.) Are divisible by 25? ( type a whole number)
This program is for kindergartners to practice knowledge on numbers divisible by 5. Write a code...
This program is for kindergartners to practice knowledge on numbers divisible by 5. Write a code using a while loop, which keeps asking the user to enter an number divisible by 5. The program(i.e the while loop) terminates when the user enters a number divisible by 5, but keeps running if the user fails to enter a number divisible by 5. Also print appropriate message after each failed try. When successful, tell the user how many attempts were needed for...
PYTHON 3 Write a program that prints the count of all prime numbers between A and...
PYTHON 3 Write a program that prints the count of all prime numbers between A and B (inclusive), where A and B are defined as follows: A = 21212 B = A + 5000 Just a recap on prime numbers: A prime number is any number, greater or equal to 2, that is divisible ONLY by 1 and itself. Here are the first 10 prime numbers: 2, 5, 7, 11, 13, 17, 19, 23, and 29. Rules: You should first...
Write a program in python that prints the count of all prime numbers between A and...
Write a program in python that prints the count of all prime numbers between A and B (inclusive), where A and B are defined as follows: A = The 5 digit unique number you had picked at the beginning of the semester B = A + 5000 Just a recap on prime numbers: A prime number is any number, greater or equal to 2, that is divisible ONLY by 1 and itself. Here are the first 10 prime numbers: 2,...
How many of the integers 1,2,....,2000 are not divisible by any of the numbers 2, 3...
How many of the integers 1,2,....,2000 are not divisible by any of the numbers 2, 3 or 11?
How many of the integers from 1 to 200 are divisible by 3,4 or 5?
How many of the integers from 1 to 200 are divisible by 3,4 or 5?
C++ PROGRAM. (C++ INTRO QUESTION) Write a program that prints the count of all prime numbers...
C++ PROGRAM. (C++ INTRO QUESTION) Write a program that prints the count of all prime numbers between A and B (inclusive), where A and B are defined as follows: A = 55000 B = A + 5000 Just a recap on prime numbers: A prime number is any number, greater or equal to 2, that is divisible ONLY by 1 and itself. Here are the first 10 prime numbers: 2, 5, 7, 11, 13, 17, 19, 23, and 29. Rules:...
1- Write a program to print only the even numbers from 100 to 200 2- Write...
1- Write a program to print only the even numbers from 100 to 200 2- Write a program to print the odd numbers from 22 – 99 3- Write a program to calculate howe many even number from 10 to 120 1- Write a program to find only the even numbers for 12 different numbers 2- Write a program to find the odd numbers for 10 different numbers 3- Write a program to calculate howe many even number and how...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT