Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Subject: PRF192- PFC

Workshop 02
Contents: 6 programs

Program 1 2 3 4 5 6
Mark 5 1 1 1 1 1

Program 1 ( 5 marks)

Write 6 modules that accepted an integer n then display triangle shapes look like
below:
void TriangleLetter1(int n);
void TriangleLetter2(int n);
void TriangleLetter3(int n);
void TriangleLetter4(int n);
void TriangleLetter5(int n);
void TriangleLetter6(int n);

Test case 1 Test case 2


Input: 5 Input: 6

huyvv10@fpt.edu.vn 1
Program 2 ( 1 mark)
Write a module void TriangleLetter7(int n) that accepted an odd integer n then
display a triangle shape look like below:

Case 1 Case 2
Input: 5 Input: 7

Program 3 (1 mark)
Develop a program void f3_ListFiboToN(int n) in C. This module will display the list
of Fibonacci numbers to n and calculate the total values of them:

Case 1 Case 2
Input: 10 Input: 25
Output: 0 1 1 2 3 5 8 Output: 0 1 1 2 3 5 8 13 21

huyvv10@fpt.edu.vn 2
Program 4 (1 mark)
Develop the module void f4_swap(int n1, int n2) in C. This module will display the
two number in accessing order.

Case 1 Case 2

Input: 9 2 Input: 12 18
Output: 2 9 Output: 12 18

Case 3 Case 4

Input: Input:
2 10
6 3
Output: 2 6 Output: 3 10

Program 5: (1 mark)
Develop the module void f5_ListChar(char c1, char c2) in C. This module will make
sure c1<c2 then display the ASCII characters from c1 to c2.

Case 1 Case 2

Input: G C Input: b d
Output: Output:

huyvv10@fpt.edu.vn 3
Case 3 Case 4

Input: d Input: z
a v
Output: Output:

Program 6: (1 mark)
Develop the module void f6_upperCaseChar(char ch) in C. This module will display
the capital of the input letter ch.

Case 1 Case 2

Input: f Input: t
Output: F Output: T

END

huyvv10@fpt.edu.vn 4

You might also like