0% found this document useful (0 votes)
51 views5 pages

2223-1 Assignment 5 at KE17503

1. The document provides instructions for Assignment 5 which requires students to develop a C program to display a reverse Pascal's triangle given a number of rows. 2. It includes a sample reverse Pascal's triangle, a flowchart depicting the logic of the program, and C code to generate the reverse Pascal's triangle for a given input. 3. The student is asked to discuss challenges in developing the program and how to overcome them.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views5 pages

2223-1 Assignment 5 at KE17503

1. The document provides instructions for Assignment 5 which requires students to develop a C program to display a reverse Pascal's triangle given a number of rows. 2. It includes a sample reverse Pascal's triangle, a flowchart depicting the logic of the program, and C code to generate the reverse Pascal's triangle for a given input. 3. The student is asked to discuss challenges in developing the program and how to overcome them.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Name: AARON ADONG ANAK NALONG Matric: BK22110178

Instruction
1. Submit the assignment latest by 30 December 2022. Need to submit a hardcopy and a softcopy.
2. Hardcopy needs to be submitted during the class.
3. Softcopy needs to be uploaded to Gradescope (entry code: NXR7R7).
4. Use UMS email to create an account in Gradescope (https://www.gradescope.com/).

Assignment 5 (10 marks)


Develop a program in C to show a reverse pascal triangle with row. Example of a reverse pascal
triangle is shown as below:

= 0: 1 4 6 4 1
= 1: 1 3 3 1
= 2: 1 2 1
= 3: 1 1
= 4: 1

a. Sketch the flowchart for the program.

START

Enter number of row

Input number

i=0;i<no_row
;i++

Creates spacing amount

j=0;j<=i;j++

KE17503 Engineering Programming


Name: AARON ADONG ANAK NALONG Matric: BK22110178

j==0||i==0

C=1

Display Number

Skip line

END

(2 marks)

KE17503 Engineering Programming


Name: AARON ADONG ANAK NALONG Matric: BK22110178

b. Develop a program to show a reverse pascal triangle with row.

#include <stdio.h>

void main()
{
int no_row,c=1,blk,i,j;
printf("Input number of rows: ");
scanf("%d",&no_row);
for(i=0;i<no_row;i++)
{
for(blk=1;blk<=no_row-i;blk++)
printf(" ");
for(j=0;j<=i;j++)
{
if (j==0||i==0)
c=1;
else
c=c*(i-j+1)/j;
printf("% 4d",c);
}
printf("\n");
}
}

CALCULATION:
Input=12

Input=11

KE17503 Engineering Programming


Name: AARON ADONG ANAK NALONG Matric: BK22110178

Input=10

Input=9

Input=8

(5 marks)

c. Discuss the challenges in developing the program. How to overcome the challenges?
The Pascal pyramid's inverse pattern presented the first difficulties. After several attempts at programme
initialization left me with nothing but the upright pyramid, I experimented with the code and used
various variables. It was discovered that the program's ability to invert the pyramid was due to the use of
the proper loop.
(3 marks)

KE17503 Engineering Programming


Name: AARON ADONG ANAK NALONG Matric: BK22110178

Rubrics for Assignments:

a. Sketch the flowchart for the program.


(2 marks)

Rubric:
Score Description
0 Not organised, the flow is illogical and not clear
1 Partly organised, the flow is slightly unclear
2 Organised, the flow is logical and clear

b. Develop a program to compute [objective]. Test the developed program with at least 5 sets of inputs,
and compare the results with manual calculations.
(5 marks)

Rubric:
Score Description
0 Coding is not attached
1 Coding is attached, but not executable
2 Executable programme with logical errors
3 Executable programme, but the flow is not matched with the flowchart
4 Readable code, executable programme, insufficient testing data
5 Readable code, executable programme, sufficient testing data

c. Discuss the challenges in developing the program. How to overcome the challenges?
(3 marks)

Rubric:
Score Description
0 Not relevant, and unable to demonstrate the ability in analysing and debugging in C
1 Little relevance, and demonstrate limited ability to analyse and debug in C
2 Relevant, and demonstrate some ability to analyse and debug in C
3 Comprehensive, and demonstrate ability to analyse and debug in C

KE17503 Engineering Programming

You might also like