© 2026 schoolict.net (Ruwan Mangala Suraweera)
1.5 Operators: Arithmetic, Comparison and Logicalකාරක: ගණිත, සංසන්දන සහ තාර්කික
G.C.E. O/L Grade 11 ICT · Lesson 1G.C.E. O/L ICT · 11 ශ්රේණිය · පාඩම 1
In this videoමේ වීඩියෝවේ
- Arithmetic: + − * / div mod.අංක ගණිත: + − * / div mod.
- 17 div 5 = 3, 17 mod 5 = 2.17 div 5 = 3, 17 mod 5 = 2.
- Comparison: = <> < > <= >= give True/False.සැසඳීම: = <> < > <= >= True/False දෙයි.
- Logical: AND, OR, NOT.තාර්කික: AND, OR, NOT.
- Brackets first, then * /, then + −.මුලින් වරහන්, පසුව * /, පසුව + −.
Notesසටහන්
Syllabus 10.5. Operators are symbols that do work on values. Arithmetic operators calculate (+ − × ÷). Comparison (relational) operators compare two values and give True or False. Logical operators join conditions (AND, OR, NOT). When there are many operators in one line, precedence decides which is done first – just like BODMAS in maths.විෂය නිර්දේශය 10.5. කාරක (operators) යනු අගයන් මත වැඩ කරන සංකේතයි. ගණිත කාරක ගණනය කරයි (+ − × ÷). සංසන්දන කාරක අගයන් දෙකක් සසඳා සත්ය හෝ අසත්ය දෙයි. තාර්කික කාරක කොන්දේසි සම්බන්ධ කරයි (AND, OR, NOT). එක් පේළියක කාරක බොහොමයක් ඇති විට, මුලින් කරන්නේ කුමක්දැයි ප්රමුඛතාව (precedence) තීරණය කරයි – ගණිතයේ BODMAS මෙන්ම.
1. Arithmetic operators1. ගණිත කාරක
| Operationමෙහෙයුම | PascalPascal | PythonPython | 17 and 517 සහ 5 |
|---|---|---|---|
| Additionඑකතු කිරීම | ++ | ++ | 2222 |
| Subtractionඅඩු කිරීම | –– | –– | 1212 |
| Multiplicationගුණ කිරීම | ** | ** | 8585 |
| Division (decimal answer)බෙදීම (දශම පිළිතුර) | // | // | 3.403.40 |
| Whole-number division (quotient)පූර්ණ සංඛ්යා බෙදීම (ලබ්ධිය) | divdiv | //// | 33 |
| Remainder (modulus)ශේෂය (modulus) | modmod | %% | 22 |
program Operators; var a, b: integer; begin a := 17; b := 5; writeln('Sum = ', a + b); writeln('Difference = ', a - b); writeln('Product = ', a * b); writeln('Division = ', a / b:0:2); writeln('Quotient = ', a div b); writeln('Remainder = ', a mod b); end.
a = 17 b = 5 print("Sum =", a + b) print("Difference =", a - b) print("Product =", a * b) print(f"Division = {a / b:.2f}") print("Quotient =", a // b) print("Remainder =", a % b)
▶ Sample runනියැදි ධාවනය · same output in Pascal and PythonPascal සහ Python දෙකෙහිම එකම ප්රතිදානය
Sum = 22 Difference = 12 Product = 85 Division = 3.40 Quotient = 3 Remainder = 2
2. Comparison operators2. සංසන්දන කාරක
A comparison always gives a logical result: True or False. Be careful – Pascal and Python write “equal” and “not equal” differently.සංසන්දනයක් සැමවිටම තාර්කික ප්රතිඵලයක් දෙයි: සත්ය හෝ අසත්ය. ප්රවේශම් වන්න – Pascal සහ Python “සමාන” සහ “අසමාන” වෙනස් ලෙස ලියයි.
| Meaningතේරුම | Pascal / pseudocodePascal / ව්යාජ කේතය | PythonPython | Example (A = 8, B = 5)උදාහරණය (A = 8, B = 5) |
|---|---|---|---|
| Equal toසමාන | == | ==== | A = B → FalseA = B → අසත්ය |
| Not equal toඅසමාන | <><> | !=!= | A <> B → TrueA <> B → සත්ය |
| Greater thanවැඩි | >> | >> | A > B → TrueA > B → සත්ය |
| Less thanඅඩු | << | << | A < B → FalseA < B → අසත්ය |
| Greater than or equalවැඩි හෝ සමාන | >=>= | >=>= | A >= 8 → TrueA >= 8 → සත්ය |
| Less than or equalඅඩු හෝ සමාන | <=<= | <=<= | B <= 4 → FalseB <= 4 → අසත්ය |
3. Logical operators3. තාර්කික කාරක
AND is True only when both conditions are True. OR is True when at least one is True. NOT reverses the value. (You met these as logic gates in Grade 10.)AND සත්ය වන්නේ කොන්දේසි දෙකම සත්ය වූ විට පමණි. OR සත්ය වන්නේ අවම වශයෙන් එකක් සත්ය වූ විටය. NOT අගය ප්රතිවිරුද්ධ කරයි. (10 ශ්රේණියේ තාර්කික ද්වාර ලෙස මේවා හමු විය.)
| AA | BB | A AND BA AND B | A OR BA OR B | NOT ANOT A |
|---|---|---|---|---|
| Trueසත්ය | Trueසත්ය | Trueසත්ය | Trueසත්ය | Falseඅසත්ය |
| Trueසත්ය | Falseඅසත්ය | Falseඅසත්ය | Trueසත්ය | Falseඅසත්ය |
| Falseඅසත්ය | Trueසත්ය | Falseඅසත්ය | Trueසත්ය | Trueසත්ය |
| Falseඅසත්ය | Falseඅසත්ය | Falseඅසත්ය | Falseඅසත්ය | Trueසත්ය |
Example: a scholarship is given only if marks ≥ 75 AND attendance ≥ 80%.උදාහරණය: ශිෂ්යත්වයක් දෙන්නේ ලකුණු ≥ 75 AND පැමිණීම ≥ 80% නම් පමණි.
📝 Pseudocodeව්යාජ කේතය (Pseudocode)
BEGIN INPUT Marks, Attendance IF Marks >= 75 AND Attendance >= 80 THEN DISPLAY "Award: Yes" ELSE DISPLAY "Award: No" ENDIF END
program Award; var marks, attendance: integer; begin write('Enter marks: '); readln(marks); write('Enter attendance %: '); readln(attendance); if (marks >= 75) and (attendance >= 80) then writeln('Award: Yes') else writeln('Award: No'); end.
marks = int(input("Enter marks: ")) attendance = int(input("Enter attendance %: ")) if marks >= 75 and attendance >= 80: print("Award: Yes") else: print("Award: No")
▶ Sample runනියැදි ධාවනය 1 · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)
Enter marks: 80 Enter attendance %: 85 Award: Yes
▶ Sample runනියැදි ධාවනය 2 · same output in Pascal and Python (typed input in yellow)Pascal සහ Python දෙකෙහිම එකම ප්රතිදානය (ටයිප් කළ ආදානය කහ පාටින්)
Enter marks: 80 Enter attendance %: 70 Award: No
4. Operator precedence4. කාරක ප්රමුඛතාව
| Orderපිළිවෙළ | Operatorsකාරක |
|---|---|
| 11 | ( ) brackets( ) වරහන් |
| 22 | NOTNOT |
| 33 | * / div mod (Python: * / // %)* / div mod (Python: * / // %) |
| 44 | + −+ − |
| 55 | Comparison = <> < > <= >=සංසන්දන = <> < > <= >= |
| 66 | AND, then ORAND, පසුව OR |
Operators at the same level are done left to right. So 20 − 8 / 4 × 2 = 20 − 2 × 2 = 20 − 4 = 16, and 10 − 4 − 3 = 6 − 3 = 3. When in doubt, use brackets – they make the order clear to everyone.එකම මට්ටමේ කාරක වමේ සිට දකුණට කරනු ලැබේ. එබැවින් 20 − 8 / 4 × 2 = 20 − 2 × 2 = 20 − 4 = 16, සහ 10 − 4 − 3 = 6 − 3 = 3. සැකයක් ඇත්නම් වරහන් භාවිත කරන්න – ඒවා පිළිවෙළ සැමට පැහැදිලි කරයි.
program Precedence; begin writeln('2 + 3 * 4 = ', 2 + 3 * 4); writeln('(2 + 3) * 4 = ', (2 + 3) * 4); writeln('20 - 8 / 4 * 2 = ', 20 - 8 / 4 * 2:0:2); writeln('10 - 4 - 3 = ', 10 - 4 - 3); end.
print("2 + 3 * 4 =", 2 + 3 * 4) print("(2 + 3) * 4 =", (2 + 3) * 4) print("20 - 8 / 4 * 2 =", f"{20 - 8 / 4 * 2:.2f}") print("10 - 4 - 3 =", 10 - 4 - 3)
▶ Sample runනියැදි ධාවනය · same output in Pascal and PythonPascal සහ Python දෙකෙහිම එකම ප්රතිදානය
2 + 3 * 4 = 14 (2 + 3) * 4 = 20 20 - 8 / 4 * 2 = 16.00 10 - 4 - 3 = 3
Key Wordsප්රධාන පද
Sample Q&Aආදර්ශ ප්රශ්න සහ පිළිතුරු
1Find 17 div 5 and 17 mod 5.17 div 5 සහ 17 mod 5 සොයන්න.
2How do you write “not equal” in Pascal and Python?Pascal සහ Python හි “අසමාන” ලියන්නේ කෙසේද?
3When is A AND B True?A AND B සත්ය වන්නේ කවදාද?
4Evaluate 2 + 3 * 4.2 + 3 * 4 ගණනය කරන්න.
5Evaluate 20 − 8 / 4 * 2.20 − 8 / 4 * 2 ගණනය කරන්න.
6How can you test whether N is even?N ඉරට්ටේදැයි පරීක්ෂා කරන්නේ කෙසේද?
MCQබහුවරණ ප්රශ්න
Choose the correct answer for each question.සෑම ප්රශ්නයකටම නිවැරදි පිළිතුර තෝරන්න.
117 mod 5 is…17 mod 5…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Remainder 2.ශේෂය 2.
217 div 5 is…17 div 5…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Whole quotient.පූර්ණ ලබ්ධිය.
3In Python, whole-number division is written…Python හි පූර්ණ සංඛ්යා බෙදීම ලියන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
//.//.
4In Python, the remainder operator is…Python හි ශේෂ කාරකය…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
%.%.
5In Pascal, “not equal to” is written…Pascal හි “අසමාන” ලියන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
<>.<>.
6In Python, “equal to” in a comparison is written…Python හි සංසන්දනයක “සමාන” ලියන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
== compares; = assigns.== සසඳයි; = පවරයි.
7A comparison operator always gives…සංසන්දන කාරකයක් සැමවිටම දෙන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
Logical result.තාර්කික ප්රතිඵලය.
8True AND False gives…True AND False දෙන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
AND needs both true.AND ට දෙකම සත්ය විය යුතුය.
9True OR False gives…True OR False දෙන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: C
OR needs one true.OR ට එකක් සත්ය නම් ප්රමාණවත්.
10NOT True gives…NOT True දෙන්නේ…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
NOT reverses.NOT ප්රතිවිරුද්ධ කරයි.
112 + 3 * 4 =2 + 3 * 4 =
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Multiply first.මුලින් ගුණ කිරීම.
12(2 + 3) * 4 =(2 + 3) * 4 =
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Brackets first.මුලින් වරහන්.
1310 − 4 − 3 =10 − 4 − 3 =
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: A
Left to right.වමේ සිට දකුණට.
14Marks = 80, attendance = 70. “Marks >= 75 AND attendance >= 80” is…ලකුණු = 80, පැමිණීම = 70. “Marks >= 75 AND attendance >= 80”…
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: D
Second part false.දෙවන කොටස අසත්යයි.
15Which operator is done first?මුලින්ම කරන්නේ කුමන කාරකයද?
✔ Correct!නිවැරදියි!✘ Not quite.වැරදියි. Correct answerනිවැරදි පිළිතුර: B
Brackets highest.වරහන් ඉහළම.
MCQ answer keyMCQ පිළිතුරු
- D – Remainder 2.ශේෂය 2.
- C – Whole quotient.පූර්ණ ලබ්ධිය.
- A – //.//.
- B – %.%.
- A – <>.<>.
- C – == compares; = assigns.== සසඳයි; = පවරයි.
- C – Logical result.තාර්කික ප්රතිඵලය.
- D – AND needs both true.AND ට දෙකම සත්ය විය යුතුය.
- C – OR needs one true.OR ට එකක් සත්ය නම් ප්රමාණවත්.
- A – NOT reverses.NOT ප්රතිවිරුද්ධ කරයි.
- B – Multiply first.මුලින් ගුණ කිරීම.
- B – Brackets first.මුලින් වරහන්.
- A – Left to right.වමේ සිට දකුණට.
- D – Second part false.දෙවන කොටස අසත්යයි.
- B – Brackets highest.වරහන් ඉහළම.
Structured Questionsව්යුහගත ප්රශ්න
1Using A = 17 and B = 5, find: (a) A + B (b) A / B (c) A div B (d) A mod B. (4 marks)A = 17 සහ B = 5 භාවිතයෙන් සොයන්න: (a) A + B (b) A / B (c) A div B (d) A mod B. (ලකුණු 4) (4 marksලකුණු 4)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
program Operators; var a, b: integer; begin a := 17; b := 5; writeln('Sum = ', a + b); writeln('Difference = ', a - b); writeln('Product = ', a * b); writeln('Division = ', a / b:0:2); writeln('Quotient = ', a div b); writeln('Remainder = ', a mod b); end.
a = 17 b = 5 print("Sum =", a + b) print("Difference =", a - b) print("Product =", a * b) print(f"Division = {a / b:.2f}") print("Quotient =", a // b) print("Remainder =", a % b)
▶ Sample runනියැදි ධාවනය · same output in Pascal and PythonPascal සහ Python දෙකෙහිම එකම ප්රතිදානය
Sum = 22 Difference = 12 Product = 85 Division = 3.40 Quotient = 3 Remainder = 2
2Complete the truth table for A AND B, A OR B and NOT A. (4 marks)A AND B, A OR B සහ NOT A සඳහා සත්යතා වගුව සම්පූර්ණ කරන්න. (ලකුණු 4) (4 marksලකුණු 4)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
3Evaluate, showing steps: (a) 2 + 3 * 4 (b) (2 + 3) * 4 (c) 20 − 8 / 4 * 2. (3 marks)පියවර පෙන්වමින් ගණනය කරන්න: (a) 2 + 3 * 4 (b) (2 + 3) * 4 (c) 20 − 8 / 4 * 2. (ලකුණු 3) (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
program Precedence; begin writeln('2 + 3 * 4 = ', 2 + 3 * 4); writeln('(2 + 3) * 4 = ', (2 + 3) * 4); writeln('20 - 8 / 4 * 2 = ', 20 - 8 / 4 * 2:0:2); writeln('10 - 4 - 3 = ', 10 - 4 - 3); end.
print("2 + 3 * 4 =", 2 + 3 * 4) print("(2 + 3) * 4 =", (2 + 3) * 4) print("20 - 8 / 4 * 2 =", f"{20 - 8 / 4 * 2:.2f}") print("10 - 4 - 3 =", 10 - 4 - 3)
▶ Sample runනියැදි ධාවනය · same output in Pascal and PythonPascal සහ Python දෙකෙහිම එකම ප්රතිදානය
2 + 3 * 4 = 14 (2 + 3) * 4 = 20 20 - 8 / 4 * 2 = 16.00 10 - 4 - 3 = 3
4A student gets a scholarship if marks ≥ 75 and attendance ≥ 80. Write the condition, and give the result for marks 80 / attendance 85 and marks 80 / attendance 70. (3 marks)ලකුණු ≥ 75 සහ පැමිණීම ≥ 80 නම් සිසුවාට ශිෂ්යත්වයක් ලැබේ. කොන්දේසිය ලියා, ලකුණු 80 / පැමිණීම 85 සහ ලකුණු 80 / පැමිණීම 70 සඳහා ප්රතිඵලය දෙන්න. (ලකුණු 3) (3 marksලකුණු 3)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
5Explain the difference between = and == in Python. (2 marks)Python හි = සහ == අතර වෙනස පහදන්න. (ලකුණු 2) (2 marksලකුණු 2)
Show model answerආදර්ශ පිළිතුර පෙන්වන්න
🎮 Game🎮 ක්රීඩා
Summary & Downloadsසාරාංශය සහ බාගත කිරීම්
Key pointsප්රධාන කරුණු
- Arithmetic: + − * / div mod.ගණිත: + − * / div mod.
- Python uses // for div and % for mod.Python div සඳහා // ද mod සඳහා % ද භාවිත කරයි.
- Comparison gives True or False.සංසන්දනය සත්ය හෝ අසත්ය දෙයි.
- Not equal: Pascal <>, Python !=.අසමාන: Pascal <>, Python !=.
- AND: both true; OR: one true; NOT: reverse.AND: දෙකම සත්ය; OR: එකක් සත්ය; NOT: ප්රතිවිරුද්ධය.
- Brackets first, then * /, then + −.මුලින් වරහන්, පසුව * /, පසුව + −.
- Same level: left to right.එකම මට්ටම: වමේ සිට දකුණට.
- N mod 2 = 0 means N is even.N mod 2 = 0 නම් N ඉරට්ටේ.
