C/C++ Programming Lab 02
C/C++ Programming Lab 02
Lab 02
1. Write a program to calculate the factorial with given integer n, which satisfies the
following:
if n is odd, factorial = 1 * 3 * 5 * … * n
if n is even, factorial = 2 * 4 * 6 *… *n
3. Input an array of n integers, n is even. Sort the first half in increasing order and second
half in decreasing order.
4. Write a program to print x pattern number. Look at the following example and work your
way to the solution:
Input: n = 5
Output:
ANSWER PART
Name-ID Tasks
Nguyễn Xuân Sơn – ITITIU20295 Q1 - Q2
Khưu Khôn Lâm – ITITIU18303 Q3 – Q4
Question 1:
Question 2:
Question 3:
Question 4: