by CodeChum Admin
The greatest common divisor, also known as GCD, is the greatest number that will, without a remainder, fully divide a pair of integers.
Now, I want you to make a program that will accept two integers and with the use of loops, print out their GCD. Make good use of conditional statements as well.
Off you go!
Input
1. First integer
2. Second integer
Output
The first line will contain a message prompt to input the first integer.
The second line will contain a message prompt to input the second integer.
The last line contains the GCD of the two integers.
Enter·the·first·integer:·6
Enter·the·second·integer:·9
GCD·of·6·and·9·is·3by CodeChum Admin
I'm really fond of even numbers, you know? That's why I'll be letting you make another even number problem yet again. This time, you need to print from a range of two inputted numbers, n1 and n2 (inclusive), all the even numbers from n2 down to n1, in descending order.
How about that?
Input
1. Value of n1
2. Value of n2
Output
The first line will contain a message prompt to input the value of n1.
The second line will contain a message prompt to input the value of n2.
The succeeding lines contain an integer.
Enter·n1:·3
Enter·n2:·10
10
8
6
4by CodeChum Admin
As I've said before, there are three types of numbers: the positive, the zero, and the negative ones. Today, we shall pay attention only to the negative ones now. Make a loop that will accept random decimal/float numbers. When the user inputs 0, the loop will terminate and then output the sum of all negative numbers inputted in 3 decimal places.
Let's code this.
Input
1. A series of decimal numbers
Output
The first lines will contain message prompts to input the decimal numbers.
The last line contains the sum of all negative numbers with 3 decimal places.
Enter·a·number:·2.4434
Enter·a·number:·-1.3433
Enter·a·number:·-2.444
Enter·a·number:·6.432
Enter·a·number:·0
Sum·of·all·negatives·=·-3.787by CodeChum Admin
Remember the game of FizzBuzz from the last time? Well, I thought of some changes in the game, and also with the help of loops as well. Firstly, you'll be asking for a random integer and then loop from 1 until that integer. Then, implement these conditions in the game:
Input
1. An integer
Output
The first line will contain a message prompt to input the integer.
The succeeding lines will contain either a string or an integer.
Enter·n:·15
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzzby CodeChum Admin
Make a program that will accept an integer and loop from 1 to that integer. Then, print all numbers from that range that are greater than 3.
Let's go!
Input
1. An integer
Output
The first line will contain a message prompt to input the integer.
The succeeding lines contain an integer.
Enter·n:·8
4
5
6
7
81.A fitness center claims that its members lose an average of 12 pounds or more the first month after joining the center. An independent agency that wanted to check this claim took a sample of 45 members and found that they lost an average of 10 pounds within the first month with standard deviation of 3 pounds. Find the p-value for this test. What will your decision be if 𝛼 = 0.05?
Carl has completed 8 math homework assignments that are all worth 20 points, and his mean score is 17. Carlos has two more 20-point homework assignments to complete before his progress report gets sent out, and he wants to raise his mean score to an 18. Is it possible for Carlos to raise his mean score to an 18? If it is possible, explain what scores he would need to get, and if not, explain why not.
On a surface of a planet, 60 J of work is done against gravity to raise a mass of 2.0kg through a height of 10m. Determine the gravitational field strength g on this planet
how many grams would be contained in 3.49 x 10^80 molecules of H2SO4?
Suppose that the probability that a corn seed from a certain batch does not germinate equals 0.02. If we plant 200 of these seeds, what is the probability that
• A) At most 5 seeds will not germinate?
• B) Exactly 3 will not germinate?
• C) At least 3 will not germinate?