Beruflich Dokumente
Kultur Dokumente
Task2 Total
25
/100
Task 3 Total
25
TA: ______
Task 4 Total
25
Let’s Begin…
Task 1 [25 marks]
Following are the required pattern for number 2 and 3 respectively:
* *
*
* *
* * *
* *
*
* *
* * *
You have to write a program that takes a positive number 'n' as input and keeps on printing the
patterns for each number in the range 2 – n.
For further clarification see the sample output:
_____________________________________________________________________________________
Task 2 [25 marks]
Write a menu driven c++ program that allows the user to perform any of the following
operations to perform:
1. To compute the factorial of a given number
2. To tell whether a number is prime or not
3. To check whether a number is even or odd
The user should have the ability to choose either of these options. The program should
continue until user exits the program explicitly. See the below sample output carefully:
_____________________________________________________________________________________
Task 3 [25 marks]
Write a program in C++ to display a specific pattern of numbers for an integer input ‘n’. The
sample patterns for inputs 5 and 3 are the following:
Sample output:
Input number: 5
123454321
1234321
12321
121
1
Input number: 3
12321
121
1
_____________________________________________________________________________________
_____________________________________________________________________________________