Pw4 Lab Sheet
Pw4 Lab Sheet
NAME : TOTAL
STUDENT ID : MARKS
1. Fixes
2. Complete
3. Manipulates
Practical Skill 4. Builds
Assessment 5. Display
[CLO2] 6. Lab Particaipation
7. Efficiently
Total Practical Skill Assessment
A. Total Practical Skill Assessment (80%) = /35 *80
1. Theory
Report 2. Discussion
Assessment 3. Conclusion
Total Report Assessment
B. Total Report Assessment (20%) = /15*20
Total A+B (100%)
DATE SUBMIT : DATE RETURN :
1 LEARNING OUTCOMES (LO):
1. Understand looping statements.
2. Apply looping statements.
2 OBJECTIVE
1. To fixes, Complete and Manipulates the Looping Statement combine with Break, Continue
and Goto statement.
2. To builds flowchart of Looping Statement combine with Break, Continue and Goto
statement.
3. To display the output of Looping Statement combine with Break, Continue and Goto
statement
3 THEORY
1. Looping Statements as a control statement operation.
2. FOR, WHILE, and DO-WHILE statements
3.BREAK, CONTINUE AND GOTO statements
4 EQUIPMENT / TOOLS
Computer, C programming language ( Dev-cpp, codeblock, dll)
Answer: Answer:
Answer: Answer:
Define goto statements.
Answer:
Answer: Answer:
#include <stdio.n>
int main()
{
int num = 10:
while (num > 0)
{
if (num = 5)
break;
printf("%f\n" num);
--num;
}
}
Modified the program in Practical Assignments 02 using combination of if and continue statement to
eliminate ONLY number 3 in the sequence of number at output display.
6
5
4
2
1
0
Complete the table below with the CORRECT Program Practical Assignment 04
value of sum and I based on program given
#include <stdio.h>
Table 1: The expected value sum and i for int main()
looping cycle in the C program practical {
assignment 04 int sum=0;
int i;
Value of sum Value of i for(int i = 0; i<=15; i++)
0 0 {
sum = sum+i;
if(i==10)
{
goto addition;
}
}
addition:
printf("%d", sum);
return 0;
}
What is the value i to becomes the program
stop and terminate the loop statement?
i =___________
Based on the C program given above (program practical assignment 04) manipulates these code to
produce the flowchart and display the output to represent it operation.
Program 1
Answer flowchart:
Explanation: Give your explanation based on program given how do…while statement done its operation
in the program.
Answer explanation:
Practical Exercise 2
Manipulates Program 2: Consider the program code below. What is the output result? Explain your result
why it is not as expected. Modify the program to meet the requirement.
Answer 1 (Output):
Answer 2 (Explanation):
Conclusion :