ITEC113 Algorithms and Programming Techniques

advertisement
EKT 150 – Introduction to Computer Programming
LAB 1
ANALYSIS, FLOW CHART AND PSEUDO-CODE
Aim: To learn how to analyze computer problem and use algorithm tool (flow chart and
pseudo-code)
Task 1: Display ‘Hi! Welcome to UniMAP!’ on screen.
Output :
Hi! Welcome to
UniMAP!
Analysis
Input:
Process:
Output :
Algorithm
Flowchart
Pseudocode
EKT 150 – Introduction to Computer Programming
LAB 1
Task 2 : Add two numbers which is input from keyboard (e.g 10 and 20) and display the
result
10 + 20 = 30
Analysis:
Input:
Process:
Output :
Algorithm
Flowchart
Pseudocode
EKT 150 – Introduction to Computer Programming
LAB 1
Task 3: Read 2 test marks (50 marks each) from keyboard. Add both marks and if the
number is greater than or equal to 40, display ‘Pass’ else display 'Fail'
Desired Output:
Enter marks : 45 40
Final marks: 80
Fail
Analysis
Input:
Process:
Output :
Algorithm
Flowchart
Pseudocode
EKT 150 – Introduction to Computer Programming
LAB 1
Task 4: Read a price and color of a price tag (‘B’ is for blue and ‘R’ is for red) from
keyboard. If the color of price tag is red, calculate price with 20% discount and display the
result. If the color of the price tag is blue, calculate price with 40% discount and display the
result. The examples of output are follows:
Enter price and tag color:
245.50 R
Enter price and tag color:
245.50 B
Discount 20%
After discount : 196.40
Discount 40%
After discount : 147.30
Analysis
Input:
Process:
Output :
Algorithm
Flowchart
Pseudocode
EKT 150 – Introduction to Computer Programming
LAB 1
Download