Sie sind auf Seite 1von 9

Faculty of Computer Science and Information

Technology

BIC10204:
Algoritma dan Pengaturcaraan/
Algorithm and Programming

LAB ACTIVITY: 01 - Introduction to Problem Solving

STUDENT’S
AHMAD KHAIRI HAFIZ BIN KHAIRUL HISHAM
NAME
MATRIC NO. CI180004

SECTION SECTION 8
1. Identify what are the input, process and output.

a. Find the mean of 4 numbers, P, Q, R and S.

b. Convert a length of an object from millimeter to centimeter.

c. Calculate the volume of a cone, if the volume is below 12cm3, print “Accepted” but if
the volume is equal or more than 12cm3, print “Not Accepted”.

2. Draw the flowchart for the given questions.

a. A company selling sports goods would like to give discounts to customers by


organizing an annual sales. If customers buy goods of more than RM 100 then
customers will get a discount of 10%. However if they buy RM 500 and above then
50% discount will be given.

b. A student marking system receives input of student’s total mark from lecturer. If a
student gets total mark of 75 or above, the system will print ‘A’. If a student’s mark is
between 65 to 74, the system will print out ‘B’. While ‘C’ will be printed out if the mark
is between 50 to 64. Whichever the total mark is below 50, ‘F’ will be printed.

3. Write the pseudocodes/algorithm for the given questions.

a. ABC bank offers 5% discount if payment is made within 10 days after notice. No
discount if the payment is made after 10 days.

b. A program receives input of an integer number. This number is then to be multiplied


by numbers from 1 to 12. The result for each multiplication is printed.
Answer

1
A.
Input Process Output
PQRS AnswerMean = (P+Q+R+S) AnswerMean
/4

B.

Input Process Output


A Answer = A / 10 Answer

C.

Input Process Output


declaring Ans1=1/2*(3.142*Rad)*High/3 if (Ans1=Max)
int Rad, High, Ans1=0, {
Max=0; Max = 12x12x12; Printf(“Accepted”);
}
else
{
Printf(“Not Accepted”);
}
2.

Start

Input item purchase

Total=+Item[x];

If
Total>=100
&& Total
Payment=Total*0.1;
<500 Yes

No

If Total>=
500
Payment=Total*0.5
Yes

No

Display Payment

End
Start

Insert student Mark

If
Mark>= Display A
75 Yes

No

If
Mark>=&&
Display B
65 Mark
<=74 Yes

No

A
A

If
Mark>=&&
64 Mark
Display C
<=50 Yes

No

If Mark Display F
<=49

Yes

No

End
3.
a.

START

Promp user to enter username and data

Read Card Data

Read user input

If it is true, print “Please Choose Your Preferred Language”

If it is not true “Please Re - Choose Your Preferred Language”

Read user input

If Language is equal to 1

Set language as BM

If Language is equal to 2

Set language as BI

If Language is equal to 3

Set language as CN

Promp user to enter amount to pay

Read amount Pay

Check day after notice

If day less or equal to 10

Total =pay-(dept*0.05)

If day more than 10

Total = pay-dept

Print Total

END

START
b

Promp user to enter a number

Read user input

Total1=+numb

Total2=+numb

Total3=+numb

Total4=+numb

Total5=+numb

Total6=+numb

Total7=+numb

Total8=+numb

Total9=+numb

Total10=+numb

Total11=+numb

Total12=+numb

Print Total1

Print Total2

Print Total3

Print Total4

Print Total5

Print Total6

Print Total7

Print Total8

Print Total9
Print Total10

Print Total11

Print Total12

End

Das könnte Ihnen auch gefallen