© 2026 schoolict.net (Ruwan Mangala Suraweera)
1.3 Flowcharts and Pseudocodeගැලීම් සටහන් සහ ව්යාජ කේත
G.C.E. O/L Grade 11 ICT · Lesson 1G.C.E. O/L ICT · 11 ශ්රේණිය · පාඩම 1
In this videoමේ වීඩියෝවේ
- Flowcharts use standard symbols.ගැලීම් සටහන් සම්මත සංකේත භාවිත කරයි.
- Oval = Start/Stop; parallelogram = input/output.ඕවලය = Start/Stop; සමාන්තරාස්රය = ආදාන/ප්රතිදාන.
- Rectangle = process; diamond = decision.සෘජුකෝණාස්රය = සැකසීම; දියමන්තිය = තීරණය.
- Pseudocode uses words like INPUT, IF, FOR.ව්යාජ කේතය INPUT, IF, FOR වැනි වචන භාවිත කරයි.
- A trace table checks an algorithm by hand.අනුරේඛන වගුව අතින් ඇල්ගොරිතමය පරීක්ෂා කරයි.
Notesසටහන්
Syllabus 10.3. We show an algorithm in two main ways. A flowchart is a picture made of standard symbols joined by arrows. Pseudocode is the algorithm written in short English-like lines, close to a real program. In this note you will learn the O/L flowchart symbols, the pseudocode words, how to change one into the other, and how to check an algorithm with a trace table.විෂය නිර්දේශය 10.3. ඇල්ගොරිතමයක් ප්රධාන ක්රම දෙකකින් පෙන්වමු. ගැලීම් සටහනක් (flowchart) යනු ඊතලවලින් සම්බන්ධ කළ සම්මත සංකේතවලින් සෑදූ රූපයකි. ව්යාජ කේතය (pseudocode) යනු සැබෑ වැඩසටහනකට සමීප, කෙටි ඉංග්රීසි වැනි පේළිවලින් ලියූ ඇල්ගොරිතමයයි. මෙම සටහනෙන් O/L ගැලීම් සටහන් සංකේත, ව්යාජ කේත වචන, එකක් අනෙකට පරිවර්තනය කරන ආකාරය සහ අනුරේඛන වගුවකින් (trace table) ඇල්ගොරිතමයක් පරීක්ෂා කරන ආකාරය ඉගෙන ගනිමු.
1. Flowchart symbols1. ගැලීම් සටහන් සංකේත
| Symbolසංකේතය | Nameනම | Used forභාවිතය |
|---|---|---|
| Rounded rectangle (oval)වටකුරු සෘජුකෝණාස්රය (ඕවලය) | Terminalආරම්භ/අවසාන | Start and Stopආරම්භය සහ නැවතීම |
| Parallelogramසමාන්තරාස්රය | Input / Outputආදාන / ප්රතිදාන | INPUT, DISPLAY, PRINTINPUT, DISPLAY, PRINT |
| Rectangleසෘජුකෝණාස්රය | Processක්රියාවලිය | Calculations, Total = A + Bගණනය කිරීම්, Total = A + B |
| Diamondදියමන්තිය (රොම්බසය) | Decisionතීරණය | A Yes/No question, e.g. Mark >= 35?ඔව්/නැත ප්රශ්නයක්, උදා Mark >= 35? |
| Small circleකුඩා රවුම | Connectorසම්බන්ධකය | Joining flow linesගැලීම් රේඛා සම්බන්ධ කිරීම |
| Arrowඊතලය | Flow lineගැලීම් රේඛාව | Shows the direction of the stepsපියවරවල දිශාව පෙන්වයි |
2. Pseudocode words2. ව්යාජ කේත වචන
Pseudocode is not a real language, so small differences are allowed. But in O/L answers we normally use these words, written in CAPITALS:ව්යාජ කේතය සැබෑ භාෂාවක් නොවන නිසා කුඩා වෙනස්කම් පිළිගැනේ. නමුත් O/L පිළිතුරුවල සාමාන්යයෙන් ලොකු අකුරින් ලියන මෙම වචන භාවිත කරමු:
| Wordවචනය | Meaningතේරුම | Flowchart symbolගැලීම් සටහන් සංකේතය |
|---|---|---|
| BEGIN / ENDBEGIN / END | Start and end of the algorithmඇල්ගොරිතමයේ ආරම්භය සහ අවසානය | Terminalආරම්භ/අවසාන |
| INPUT / READINPUT / READ | Get dataදත්ත ලබා ගැනීම | Input/Outputආදාන/ප්රතිදාන |
| DISPLAY / PRINTDISPLAY / PRINT | Show a resultප්රතිඵලයක් පෙන්වීම | Input/Outputආදාන/ප්රතිදාන |
| Total = A + BTotal = A + B | Calculate and storeගණනය කර ගබඩා කිරීම | Processක්රියාවලිය |
| IF … THEN … ELSE … ENDIFIF … THEN … ELSE … ENDIF | Selectionවරණය | Decisionතීරණය |
| FOR … ENDFOR, WHILE … ENDWHILE, REPEAT … UNTILFOR … ENDFOR, WHILE … ENDWHILE, REPEAT … UNTIL | Iterationපුනරාවර්තනය | Decision + arrow going backතීරණය + ආපසු යන ඊතලය |
3. Example: the larger of two numbers3. උදාහරණය: සංඛ්යා දෙකකින් විශාල එක
Look at the three forms below. Every flowchart box matches one pseudocode line, and every pseudocode line matches one or two lines of code.පහත ආකාර තුන බලන්න. සෑම ගැලීම් සටහන් කොටුවක්ම ව්යාජ කේත පේළියකට ද, සෑම ව්යාජ කේත පේළියක්ම කේත පේළි එකකට හෝ දෙකකට ද ගැළපේ.
📝 Pseudocodeව්යාජ කේතය (Pseudocode)
BEGIN INPUT A, B IF A > B THEN DISPLAY A ELSE DISPLAY B ENDIF END
program Largest2; var a, b: integer; begin write('Enter first number: '); readln(a); write('Enter second number: '); readln(b); if a > b then writeln('Largest = ', a) else writeln('Largest = ', b); end.
a = int(input("Enter first number: ")) b = int(input("Enter second number: ")) if a > b: print("Largest =", a) else: print("Largest =", b)
▶ Sample runනියැදි ධාවනය 1 · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)
Enter first number: 45 Enter second number: 72 Largest = 72
▶ Sample runනියැදි ධාවනය 2 · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)
Enter first number: 90 Enter second number: 34 Largest = 90
4. Converting a flowchart into pseudocode4. ගැලීම් සටහනක් ව්යාජ කේතයට පරිවර්තනය
Converting pseudocode into a flowchart is the same table read backwards: draw one symbol for each line, and draw an arrow back to the diamond for every loop.ව්යාජ කේතය ගැලීම් සටහනකට පරිවර්තනය කිරීම එම වගුවම පසුපසට කියවීමයි: සෑම පේළියකටම එක් සංකේතයක් අඳින්න, සෑම ලූපයකටම දියමන්තියට ආපසු ඊතලයක් අඳින්න.
5. Example with a loop: sum of 1 to N5. ලූපයක් සහිත උදාහරණය: 1 සිට N දක්වා එකතුව
📝 Pseudocodeව්යාජ කේතය (Pseudocode)
BEGIN INPUT N Total = 0 i = 1 WHILE i <= N DO Total = Total + i i = i + 1 ENDWHILE DISPLAY Total END
program SumToN; var n, i, total: integer; begin write('Enter N: '); readln(n); total := 0; i := 1; while i <= n do begin total := total + i; i := i + 1; end; writeln('Sum = ', total); end.
n = int(input("Enter N: ")) total = 0 i = 1 while i <= n: total = total + i i = i + 1 print("Sum =", total)
▶ Sample runනියැදි ධාවනය · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)
Enter N: 5 Sum = 15
6. Trace tables (dry run)6. අනුරේඛන වගු (dry run)
A trace table shows the value of each variable after every step. Doing this on paper is called a dry run. It helps you find mistakes before running the program. Here is the trace of the program above for N = 5:අනුරේඛන වගුවක් සෑම පියවරකටම පසු එක් එක් විචල්යයේ අගය පෙන්වයි. මෙය කඩදාසියේ කිරීම dry run ලෙස හැඳින්වේ. වැඩසටහන ධාවනයට පෙර වැරදි සොයා ගැනීමට එය උපකාරී වේ. N = 5 සඳහා ඉහත වැඩසටහනේ අනුරේඛනය මෙන්න:
| Stepපියවර | ii | TotalTotal | i <= 5 ?i <= 5 ? |
|---|---|---|---|
| startstart | 11 | 00 | –– |
| looploop | 11 | 11 | Yesඔව් |
| looploop | 22 | 33 | Yesඔව් |
| looploop | 33 | 66 | Yesඔව් |
| looploop | 44 | 1010 | Yesඔව් |
| looploop | 55 | 1515 | Yesඔව් |
| checkcheck | 66 | 1515 | Noනැත |
The last row shows i = 6, so the condition i <= 5 is No and the loop stops. Total = 15, which matches the real output “Sum = 15”.අවසාන පේළියේ i = 6 නිසා i <= 5 කොන්දේසිය නැත වී ලූපය නවතී. Total = 15, එය සැබෑ ප්රතිදානය වන “Sum = 15” ට ගැළපේ.
7. Try it: trace this loop7. උත්සාහ කරන්න: මෙම ලූපය අනුරේඛනය කරන්න
📝 Pseudocodeව්යාජ කේතය (Pseudocode)
BEGIN S = 0 X = 1 WHILE X < 10 DO S = S + X X = X + 3 ENDWHILE DISPLAY S, X END
| Stepපියවර | SS | XX | X < 10 ?X < 10 ? |
|---|---|---|---|
| startstart | 00 | 11 | –– |
| looploop | 11 | 44 | Yesඔව් |
| looploop | 55 | 77 | Yesඔව් |
| looploop | 1212 | 1010 | Yesඔව් |
| checkcheck | 1212 | 1010 | Noනැත |
Output: 12 10 (S = 12, X = 10). Check: 1 + 4 + 7 = 12.ප්රතිදානය: 12 10 (S = 12, X = 10). පරීක්ෂාව: 1 + 4 + 7 = 12.
Key Wordsප්රධාන පද
Sample Q&Aආදර්ශ ප්රශ්න සහ පිළිතුරු
1Which symbol is used for a decision?තීරණයක් සඳහා භාවිත කරන සංකේතය කුමක්ද?
2Which symbol is used for INPUT and DISPLAY?INPUT සහ DISPLAY සඳහා භාවිත කරන සංකේතය කුමක්ද?
3What is pseudocode?ව්යාජ කේතය යනු කුමක්ද?
4How do you know a diamond is part of a loop?දියමන්තියක් ලූපයක කොටසක් බව දැනගන්නේ කෙසේද?
5What is a trace table used for?අනුරේඛන වගුවක් භාවිත කරන්නේ කුමකටද?
6Trace S = 0, X = 1; WHILE X < 10: S = S + X, X = X + 3. Give the final S and X.S = 0, X = 1; WHILE X < 10: S = S + X, X = X + 3 අනුරේඛනය කරන්න. අවසාන S සහ X දෙන්න.
MCQබහුවරණ ප්රශ්න
Choose the correct answer for each question.සෑම ප්රශ්නයකටම නිවැරදි පිළිතුර තෝරන්න.
1The flowchart symbol for Start and Stop is the…Start සහ Stop සඳහා ගැලීම් සටහන් සංකේතය…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Terminal = rounded.Terminal = වටකුරු.
2“Total = A + B” is drawn in a…“Total = A + B” අඳින්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Calculation = process.ගණනය = ක්රියාවලිය.
3“DISPLAY Total” is drawn in a…“DISPLAY Total” අඳින්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Output = parallelogram.ප්රතිදානය = සමාන්තරාස්රය.
4How many exits does a decision diamond have?තීරණ දියමන්තියකට පිටවීම් කීයක් තිබේද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Yes and No.ඔව් සහ නැත.
5A small circle in a flowchart is a…ගැලීම් සටහනක කුඩා රවුමක්…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Connector.සම්බන්ධකය.
6Pseudocode is…ව්යාජ කේතය…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Not run by computer.පරිගණකය ධාවනය නොකරයි.
7A diamond with an arrow coming back to it shows…ආපසු ඊතලයක් පැමිණෙන දියමන්තියක් පෙන්වන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Arrow back = repeat.ආපසු ඊතලය = පුනරාවර්තනය.
8Following an algorithm by hand on paper is called a…කඩදාසියේ අතින් ඇල්ගොරිතමයක් අනුගමනය කිරීම හඳුන්වන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Dry run.Dry run.
9In the sum 1 to N program with N = 5, the output is…N = 5 සමඟ 1 සිට N දක්වා එකතු කරන වැඩසටහනේ ප්රතිදානය…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
1+2+3+4+5 = 15.1+2+3+4+5 = 15.
10In that program, the value of i when the loop stops is…එම වැඩසටහනේ ලූපය නවතින විට i හි අගය…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Stops when i <= 5 is false.i <= 5 අසත්ය වූ විට නවතී.
11For inputs 45 and 72, the larger-number program displays…45 සහ 72 ආදාන සඳහා විශාල සංඛ්යා වැඩසටහන පෙන්වන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
72 > 45.72 > 45.
12Trace: S = 0, X = 1; WHILE X < 10: S = S + X; X = X + 3. Output “S X” is…අනුරේඛනය: S = 0, X = 1; WHILE X < 10: S = S + X; X = X + 3. ප්රතිදානය “S X”…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
S=1,5,12; X=4,7,10.S=1,5,12; X=4,7,10.
13When converting a flowchart, the Stop terminal becomes…ගැලීම් සටහනක් පරිවර්තනයේදී Stop terminal එක වන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Stop → END.Stop → END.
14The Yes branch of a decision (no loop) goes after…තීරණයක (ලූපයක් නැති) ඔව් ශාඛාව යන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
IF cond THEN yes ELSE no.IF cond THEN ඔව් ELSE නැත.
15Which is a rule for a good flowchart?හොඳ ගැලීම් සටහනක නීතියක් කුමක්ද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
One Start, one Stop.එක් Start, එක් Stop.
MCQ answer keyMCQ පිළිතුරු
- A – Terminal = rounded.Terminal = වටකුරු.
- C – Calculation = process.ගණනය = ක්රියාවලිය.
- A – Output = parallelogram.ප්රතිදානය = සමාන්තරාස්රය.
- B – Yes and No.ඔව් සහ නැත.
- C – Connector.සම්බන්ධකය.
- D – Not run by computer.පරිගණකය ධාවනය නොකරයි.
- C – Arrow back = repeat.ආපසු ඊතලය = පුනරාවර්තනය.
- D – Dry run.Dry run.
- B – 1+2+3+4+5 = 15.1+2+3+4+5 = 15.
- A – Stops when i <= 5 is false.i <= 5 අසත්ය වූ විට නවතී.
- B – 72 > 45.72 > 45.
- C – S=1,5,12; X=4,7,10.S=1,5,12; X=4,7,10.
- A – Stop → END.Stop → END.
- D – IF cond THEN yes ELSE no.IF cond THEN ඔව් ELSE නැත.
- B – One Start, one Stop.එක් Start, එක් Stop.
Structured Questionsව්යුහගත ප්රශ්න
1Draw the flowchart symbols for (i) terminal (ii) input/output (iii) process (iv) decision and say what each is used for. (4 marks)(i) terminal (ii) ආදාන/ප්රතිදාන (iii) ක්රියාවලිය (iv) තීරණය සඳහා ගැලීම් සටහන් සංකේත ඇඳ, එක් එකක් භාවිත කරන්නේ කුමකටදැයි සඳහන් කරන්න. (ලකුණු 4) (4 marksලකුණු 4)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
2Write pseudocode to input two numbers and display the larger one. (4 marks)සංඛ්යා දෙකක් ආදානය කර විශාල එක පෙන්වන ව්යාජ කේතය ලියන්න. (ලකුණු 4) (4 marksලකුණු 4)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
📝 Pseudocodeව්යාජ කේතය (Pseudocode)
BEGIN INPUT A, B IF A > B THEN DISPLAY A ELSE DISPLAY B ENDIF END
3Draw a flowchart to find the sum of the numbers 1 to N. (5 marks)1 සිට N දක්වා සංඛ්යාවල එකතුව සොයන ගැලීම් සටහනක් අඳින්න. (ලකුණු 5) (5 marksලකුණු 5)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
4Complete a trace table for S = 0, X = 1; WHILE X < 10: S = S + X; X = X + 3; DISPLAY S, X. (4 marks)S = 0, X = 1; WHILE X < 10: S = S + X; X = X + 3; DISPLAY S, X සඳහා අනුරේඛන වගුවක් සම්පූර්ණ කරන්න. (ලකුණු 4) (4 marksලකුණු 4)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
| Stepපියවර | SS | XX | X < 10 ?X < 10 ? |
|---|---|---|---|
| startstart | 00 | 11 | –– |
| looploop | 11 | 44 | Yesඔව් |
| looploop | 55 | 77 | Yesඔව් |
| looploop | 1212 | 1010 | Yesඔව් |
| checkcheck | 1212 | 1010 | Noනැත |
5Give two advantages of pseudocode over a flowchart, and one advantage of a flowchart. (3 marks)ගැලීම් සටහනකට වඩා ව්යාජ කේතයේ වාසි දෙකක් සහ ගැලීම් සටහනක එක් වාසියක් දෙන්න. (ලකුණු 3) (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
🎮 Game🎮 ක්රීඩා
Summary & Downloadsසාරාංශය සහ බාගත කිරීම්
Key pointsප්රධාන කරුණු
- Flowchart = picture; pseudocode = English-like lines.ගැලීම් සටහන = රූපය; ව්යාජ කේතය = ඉංග්රීසි වැනි පේළි.
- Terminal (rounded) = Start/Stop.Terminal (වටකුරු) = Start/Stop.
- Parallelogram = input/output.සමාන්තරාස්රය = ආදාන/ප්රතිදාන.
- Rectangle = process; diamond = decision.සෘජුකෝණාස්රය = ක්රියාවලිය; දියමන්තිය = තීරණය.
- A diamond has Yes and No exits.දියමන්තියකට ඔව් සහ නැත පිටවීම් ඇත.
- Arrow back to a diamond = loop.දියමන්තියට ආපසු ඊතලය = ලූපය.
- Convert box by box, line by line.කොටුවෙන් කොටුව, පේළියෙන් පේළිය පරිවර්තනය කරන්න.
- A trace table checks an algorithm (dry run).අනුරේඛන වගුවක් ඇල්ගොරිතමයක් පරීක්ෂා කරයි (dry run).
