Sie sind auf Seite 1von 9

1.

Design an algorithm using flowchart to print the visitors admission charges for Zoo
Negara. The admission charges for Zoo Negara are varies according to the visitors
category. The charges are as follows:

Category Age group Charges (RM)


OKU Nil Free
Toddler Under 3 Free
Student Nil 10
Children 3-12 16
Adult 13 - 64 44
Senior 65 and above 21

Sample Input / Output


Sample 1:
Category: Children
Admission charges: 10
Sample 2:
Category: Adult
Admission charges: 44
2. A program is required to read and print a series of names and exam scores for students
enrolled in a mathematics course. The class average is to be calculated and printed at the
end of the report. Scores can range from 0 to 100. The last record contains a score of 999
and is not to be included in the calculations.
3. Print_examination_scores
4. Set total_score to zero
5. Set total_students to zero
6. Read name, exam_score
7. DOWHILE exam_score not = 999
8. add 1 to total_students
9. Print name, exam_score
10. add exam_score to total_score
11. Read name, exam_score
12. ENDDO
13. IF total_students not = zero THEN
14. average_score = total_score/total_students
15. Print average_score
16. ENDIF
Convert the following pseudo code into a flowchart

Begin
sum = 0
count = 1
REPEAT
IF count is even THEN
sum = sum + count
count = count + 1
UNTIL count > 20
DISPLAY sum
Start

Sum = 0

Count =1

Is Count Sum = Sum + Count


an even
number Yes
?

No

Count = Count + 1

No
Is Count
> 20 ?

Yes

Display Sum

Stop
Convert the following pseudocode into a flowchart

DO
DISPLAY main menu
GET marks
IF marks <40
DISPLAY Fail
ELSE IF marks <50
DISPLAY Pass
ELSE IF marks <80
DISPLAY Credit
ELSE IF marks <=100
DISPLAY Distinction
END IF
ENDDO
Start

DISPLAY
main menu

GET
marks

marks Yes
DISPLAY
< =40
Fail

No

marks Yes
DISPLAY
< =50
Pass

No

marks Yes
DISPLAY
<= 80
Credit

No

marks Yes
DISPLAY
<= 100
Distinction

No

Stop
a) Draw the flowchart using the appropriate symbols and arrows to show the sequence of steps in
finding the profit or loss in the trading of an item.

Start

Read cost price CS


Read selling price SP

Is Profit = SP-CP
SP>C
P

Loss=CP=SP

Print loss Print profit

End
a) A weather station receives 15 temperatures expressed in degrees Fahrenheit. Write a
pseudocode that will accept each Fahrenheit temperature, convert it to Celsius and
display the converted temperature to the screen. After 15 temperatures have been
processed, the words All temperatures processed are to be displayed on the screen.
c_temp = (f_temp 32) * 5/9

Fahrenheit_Celsius_conversion
Set temperature_count to zero
DOWHILE temperature_count < 15
Prompt operator for f_temp
Get f_temp
compute c_temp = (f_temp 32) * 5/9
Display c_temp
add 1 to temperature_count
ENDDO
Display All temperatures processed to the screen
END

Das könnte Ihnen auch gefallen