4. A Shorter Three
by CodeChum Admin
Numbers in threes are awesome! But the one last time was too lengthy to look at, so I just want to view it in a shorter but still readable format.
You okay with this task?
Instructions:
Print out all numbers from 1 to 100 that is divisible by 3 using a for loop just like the last problem, but this time, with each number only separated by the space like that of the sample output.
Output
A line containing integers divisible by 3 separated by a space.
3·6·9·12·15·18·21·24·27·30·33·36·39·42·45·48·51·54·57·60·63·66·69·72·75·78·81·84·87·90·93·96·99
3. There was a Three
by CodeChum Admin
I'm bored with just basic counting. How about we do some complex things this time? But I don't want to be associated with any number that's not divisible by 3.
Think you can handle this?
Instructions:
Print out all numbers from 1 to 100 that is divisible by 3, each in separate lines, using a for loop.
Output
Multiple lines containing an integer that is divisible by 3.
3
6
9
12
15
18
21
24
27
30
33
36
39
42
45
48
51
54
57
60
63
66
69
72
75
78
81
84
87
90
93
96
99
by CodeChum Admin
For those of you who may not now, a factorial is a product of multiplying from 1 until the number. Now, you must make a program that will accept an integer and then print out its factorial using loops.
Are you up for this task?
Instructions:
Input
A line containing an integer.
5Output
A line containing an integer.
1201. FizzBuzz
by CodeChum Admin
Let’s play a game of FizzBuzz! It’s quite the same with your childhood “PopCorn” game, but with a little bit of twist to align it with programming.
Are you ready?
Instructions:
Input a random positive integer in one line. This will serve as the ending point of your loop.
Using a for() loop, loop from 1 to the ending point (inclusive) and perform the following statements:
If the number is only divisible by 3, print "Fizz"
If the number is only divisible by 5, print "Buzz"
If the number is divisible by both 3 and 5, print "FizzBuzz"
If nothing is true in the previous conditions, skip the number
Input
A line containing an integer.
15
Output
Multiple lines containing a string.
Fizz
Buzz
Fizz
Fizz
Buzz
Fizz
FizzBuzz
by CodeChum Admin
Manipulating values from a series of numbers is fun, but let's try exploring the use of loops a little more.
How about printing out each digit of a number by place values, in ascending order?
Instructions:
Input
A line containing an integer.
214Output
Multiple lines containing an integer.
4
1
2by CodeChum Admin
I always want to look at the positive side of things, so I decide to seriously look at positive numbers, too!
Will you code along with me?
Instructions:
Input
Multiple lines containing an integer on each.
2
3
4
-1
-5
1
0Output
A line containing an integer.
10by 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
A line containing two integers separated by a space.
3·10Output
Multiple lines containing an integer.
10
8
6
4Write a program that will ask a user to input a number n. The program will then display a
Fibonacci sequence with n as number of displayed sequence.
Question 6 (40 marks) 200-500 words per explanation and avoid plagiarism.
I. Explain the following in your own words without copying it from anywhere. Give
examples each in your explanation.
a. Class hierarchies b. Algorithms
c. Flowcharts
d. Control structure
Discuss Object oriented programming in c++ with 4 points. Each point shoult not be less
than 200 words.
Question 6 (40 marks) 200-50