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?
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...
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?
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...
How many positive integers less than 50 are not divisible by 2, 3 or 5? [8]...
How many positive integers less than 50 are not divisible by 2, 3 or 5? [8] Check your solution by listing the numbers and eliminating those which are divisible by 2, 3 or 5 and counting the remainder.
How many positive whole numbers of five digits can be divided by 3? Out of that...
How many positive whole numbers of five digits can be divided by 3? Out of that sample, on how many is the first digit an even number?
Problem 2: Python 3 Implement a function called gee_whiz that does the following: given argument n,...
Problem 2: Python 3 Implement a function called gee_whiz that does the following: given argument n, a positive integer, it returns a list of n tuples corresponding to the numbers 1 through n (both inclusive): the tuple for the number k consists of k as the first component, and exactly one of the following strings as the second: • the string 'two!' if k is divisible by 2 • the string 'three!' if k is divisible by 3 • the...
10. Three-digit numbers are to be made from the 10 digits 0, 1, 2, …, 9....
10. Three-digit numbers are to be made from the 10 digits 0, 1, 2, …, 9. (Assume that the first digit cannot be 0.) a. How many numbers can be made if repetitions are not allowed and the number must be divisible by 10? b. How many numbers can be made if repetitions are allowed and the number must be even? c. How many numbers can be made if repetitions are not allowed and the number must be odd and...
Here are the basic rules of Club Keno: You choose how many numbers you will pick....
Here are the basic rules of Club Keno: You choose how many numbers you will pick. You can pick anywhere from 1 to 10 different numbers. Pick your numbers between 1 and 80. A drawing is held in which 20 numbers are picked. Depending on how many of your numbers come up in the drawing, you win various amounts of money. In a previous assignment we saw the number of ways to choose exactly x correct from a total of...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT