2223-1 Assignment 5 at KE17503
2223-1 Assignment 5 at KE17503
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/).
= 0: 1 4 6 4 1
= 1: 1 3 3 1
= 2: 1 2 1
= 3: 1 1
= 4: 1
START
Input number
i=0;i<no_row
;i++
j=0;j<=i;j++
j==0||i==0
C=1
Display Number
Skip line
END
(2 marks)
#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
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)
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