School of Systems and Technology
Programming Fundamentals
Assignment
Question 01:
Design a C++ program that prints the multiplication table of 2 using while loop.
Question 02:
Design a C++ program that displays the following pattern using Nested while loop.
1
12
123
1234
12345
Question 03:
The factorial of a nonnegative integer n is written n! (Pronounced “n factorial”) and is defined as
follows: n! = n · (n - 1) · (n - 2) · … · 1 (for values of n greater than or equal to 1) and n! = 1
(for n = 0).
For example, 5! = 5 · 4 · 3 · 2 · 1, which is 120.
Write a program that reads a nonnegative integer and computes and prints its factorial using do
while loop.
Question 04:
Create a program to generate the Fibonacci series using while loop.
The program should ask the user a limit (a number) till which Fibonacci series is to be calculated.
It should also count the total number of Fibonacci integers that are generated.
Example of Fibonacci series: 1 1 2 3 5 8 13 21 34 55……
Question 05:
Use for loops to construct a program that displays a pyramid of Xs on the screen. The pyramid
should look like this
Except that it should be 20 lines high, instead of the 5 lines shown here.