├── MID ├── Questions │ ├── Answers.docx │ ├── IMG-20201221-WA0000.jpg │ ├── IMG-20201221-WA0001.jpg │ ├── IMG-20201221-WA0002.jpg │ ├── IMG-20201221-WA0003.jpg │ ├── IMG-20201221-WA0004.jpg │ ├── IMG-20201221-WA0005.jpg │ ├── IMG-20201221-WA0006.jpg │ ├── IMG-20201221-WA0007.jpg │ ├── IMG-20201221-WA0008.jpg │ ├── IMG-20201221-WA0009.jpg │ ├── IMG-20201221-WA0010.jpg │ ├── IMG-20201221-WA0011.jpg │ ├── IMG-20201221-WA0012.jpg │ ├── IMG-20201221-WA0013.jpg │ ├── IMG-20201221-WA0014.jpg │ ├── IMG-20201221-WA0015.jpg │ ├── IMG-20201221-WA0016.jpg │ ├── IMG-20201221-WA0017.jpg │ ├── IMG-20201221-WA0018.jpg │ ├── IMG-20201221-WA0019.jpg │ ├── IMG-20201221-WA0020.jpg │ ├── IMG-20201221-WA0021.jpg │ ├── IMG-20201221-WA0022.jpg │ ├── IMG-20201221-WA0023.jpg │ ├── IMG-20201221-WA0024.jpg │ ├── IMG-20201221-WA0025.jpg │ ├── IMG-20201221-WA0026.jpg │ ├── IMG-20201221-WA0027.jpg │ ├── IMG-20201221-WA0028.jpg │ ├── IMG-20201221-WA0029.jpg │ ├── IMG-20201221-WA0030.jpg │ ├── IMG-20201221-WA0031.jpg │ ├── IMG-20201221-WA0032.jpg │ ├── IMG-20201221-WA0033.jpg │ ├── IMG-20201221-WA0034.jpg │ ├── IMG-20201221-WA0035.jpg │ ├── IMG-20201221-WA0036.jpg │ ├── IMG-20201221-WA0037.jpg │ ├── IMG-20201221-WA0038.jpg │ ├── IMG-20201221-WA0039.jpg │ ├── IMG-20201221-WA0040.jpg │ ├── IMG-20201221-WA0041.jpg │ ├── IMG-20201221-WA0042.jpg │ ├── IMG-20201221-WA0043.jpg │ ├── IMG-20201221-WA0044.jpg │ ├── IMG-20201221-WA0045.jpg │ ├── IMG-20201221-WA0046.jpg │ ├── IMG-20201221-WA0047.jpg │ ├── IMG-20201221-WA0048.jpg │ ├── IMG-20201221-WA0049.jpg │ ├── IMG-20201221-WA0050.jpg │ ├── IMG-20201221-WA0051.jpg │ ├── IMG-20201221-WA0052.jpg │ ├── IMG-20201221-WA0053.jpg │ ├── IMG-20201221-WA0054.jpg │ ├── IMG-20201221-WA0055.jpg │ ├── IMG-20201221-WA0056.jpg │ ├── IMG-20201221-WA0057.jpg │ ├── IMG-20201221-WA0058.jpg │ ├── IMG-20201221-WA0059.jpg │ ├── IMG-20201221-WA0060.jpg │ ├── IMG-20201221-WA0061.jpg │ ├── IMG-20201221-WA0062.jpg │ ├── IMG-20201221-WA0063.jpg │ ├── IMG-20201221-WA0064.jpg │ ├── IMG-20201221-WA0065.jpg │ ├── IMG-20201221-WA0066.jpg │ ├── IMG-20201221-WA0067.jpg │ ├── IMG-20201221-WA0068.jpg │ ├── IMG-20201221-WA0069.jpg │ ├── IMG-20201221-WA0070.jpg │ ├── IMG-20201221-WA0071.jpg │ ├── IMG-20201221-WA0072.jpg │ ├── IMG-20201221-WA0073.jpg │ ├── IMG-20201221-WA0074.jpg │ ├── IMG-20201221-WA0075.jpg │ ├── IMG-20201221-WA0076.jpg │ ├── IMG-20201221-WA0077.jpg │ ├── IMG-20201221-WA0078.jpg │ ├── IMG-20201221-WA0079.jpg │ ├── IMG-20201221-WA0080.jpg │ ├── IMG-20201221-WA0081.jpg │ ├── IMG-20201221-WA0082.jpg │ ├── IMG-20201221-WA0083.jpg │ ├── IMG-20201221-WA0084.jpg │ ├── IMG-20201221-WA0085.jpg │ ├── IMG-20201221-WA0086.jpg │ ├── IMG-20201221-WA0087.jpg │ ├── IMG-20201221-WA0088.jpg │ └── june │ │ ├── WhatsApp Image 2020-12-14 at 12.57.54 AM.jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.30.29 AM.jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.30.59 AM.jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.31.21 AM.jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.31.55 AM.jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.31.56 AM.jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.32.23 AM.jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.32.37 AM.jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.34.23 AM.jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.39.38 AM.jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.41.31 AM.jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.57.11 AM.jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.57.27 AM.jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.31.56 AM (1).jpeg │ │ ├── WhatsApp Image 2020-12-22 at 12.31.56 AM (2).jpeg │ │ └── WhatsApp Image 2020-12-22 at 12.32.23 AM (1).jpeg ├── Sample_MID_Exam_Questions.pdf └── Introduction to Programming_Model Paper.pdf ├── Tutorials ├── 2020 Tutorials │ ├── Tutorial 12 │ │ ├── number.dat │ │ ├── appointment.dat │ │ ├── Tutorial 12.pdf │ │ ├── Question1.(d)-Anjana.c │ │ ├── Question2(a,b)-Anjana.c │ │ ├── Question1.(c)-Anjana.c │ │ └── Question2.(c)-Anjana.c │ ├── Tutorial 4 │ │ ├── Question1-i-Thushara.c │ │ ├── Tutorial 4.pdf │ │ ├── Question1-ii-Thushara.c │ │ ├── Question3-Thushara.c │ │ ├── Question4-Thushara.c │ │ └── Question2-Anjana.c │ ├── Tutorial 10 │ │ ├── Tutorial 10.pdf │ │ ├── Additional Exercises │ │ │ ├── Question2-Anjana.c │ │ │ ├── Question1-Anjana.c │ │ │ ├── Question1-Thushara.c │ │ │ └── Question2-Thushara.c │ │ ├── Question3-Anjana.c │ │ ├── Question1-Anjana.c │ │ ├── Question1-full-Thushara.c │ │ ├── Question3-Thushara.c │ │ └── Question2-Thushara.c │ ├── Tutorial 5 │ │ ├── Tutorial 5.pdf │ │ ├── Question4-Anjana.c │ │ ├── Additional Exercises │ │ │ ├── Question5-Anjana.c │ │ │ ├── Question6-Anjana.c │ │ │ ├── Question4-Anjana.c │ │ │ ├── Question2-Anjana.c │ │ │ └── Question3-Anjana.c │ │ └── Question3-Anjana.c │ ├── Tutorial 6 │ │ ├── Tutorial 6.pdf │ │ ├── Question2-Anjana.c │ │ ├── Question7-Anjana.c │ │ ├── Question3-Anjana.c │ │ ├── Question1-Anjana.c │ │ ├── Question6-Anjana.c │ │ ├── Question4-Anjana.c │ │ └── Question5-Anjana.c │ ├── Tutorial 7 │ │ ├── Tutorial 7.pdf │ │ ├── Additional Exercises │ │ │ ├── Question1-Anjana.c │ │ │ └── Question2-Anjana.c │ │ ├── Question3-Anjana.c │ │ └── Question2-Anjana.c │ ├── Tutorial 8 │ │ ├── Tutorial 8.pdf │ │ ├── Question2-Anjana.c │ │ ├── Additional Exercises │ │ │ ├── Question1-i-Thushara.c │ │ │ ├── Question1-ii-Thushara.c │ │ │ ├── Question2-Anjana.c │ │ │ └── Question1-Anjana.c │ │ └── Question3-Anjana.c │ ├── Tutorial 9 │ │ ├── Tutorial 9.pdf │ │ ├── Question1-Thushara.c │ │ └── Question2-Thushara.c │ └── Tutorial 11 │ │ ├── Question1-Anjana.c │ │ ├── Question2-Anjana.c │ │ ├── Question2-Thushara.c │ │ ├── Question1-Thushara.c │ │ ├── Additional Exercises │ │ ├── Question1(a,b)-Anjana.c │ │ └── Question1(c)-Anjana.c │ │ ├── Question3-Anjana.c │ │ └── Question3-Thushara.c ├── 2021 Feb Tutorials │ ├── TUTORIAL 10 │ │ └── Q1 │ │ │ ├── number.txt │ │ │ └── tutorial 1.c │ ├── TUTORIAL 03 │ │ └── Tutorial3.pdf │ ├── TUTORIAL 04 │ │ ├── Exercise 3.c │ │ ├── Tutorial4.pdf │ │ └── Exercise 1.c │ ├── TUTORIAL 05 │ │ ├── Tutorial5.pdf │ │ ├── Exercise 1 A.c │ │ ├── Exercise 1 B.c │ │ ├── Exercise 4.c │ │ ├── Exercise 3 A.c │ │ └── Exercise 1 C.c │ ├── TUTORIAL 06 │ │ ├── Tutorial6.pdf │ │ ├── EX 1 │ │ │ ├── Exercise 1 Practice to use math library functions 1.c │ │ │ ├── Exercise 1 Practice to use math library functions 2.c │ │ │ ├── Exercise 1 Practice to use math library functions 3.c │ │ │ ├── Exercise 1 Practice to use math library functions 4.c │ │ │ └── Exercise 1 Practice to use math library functions 5.c │ │ ├── Exercise 1.c │ │ ├── Exercise 2.c │ │ └── Exercise 3.c │ ├── TUTORIAL 07 │ │ ├── Exercise 1.c │ │ └── Tutorial7.pdf │ ├── TUTORIAL 08 │ │ ├── Tutorial8.pdf │ │ ├── Exercise 1 A.c │ │ ├── Exercise 1 B.c │ │ ├── Exercise 4.c │ │ ├── Exercise 1 C.c │ │ └── Exercise 3.c │ └── TUTORIAL 09 │ │ ├── Tutorial9.pdf │ │ ├── Exercise 1.c │ │ ├── Exercise 2.c │ │ └── Exercise 3.c └── 2022 Oct Tutorials │ ├── Turorial 05 │ ├── Tutorial5.pdf │ ├── E01-i-Shanelka.c │ ├── E01-ii-Shanelka.c │ ├── E04-Shanelka.c │ ├── E01-iii-Shanelka.c │ └── E02-Shanelka.c │ └── Tutorial 01 │ ├── Tutorial 1.pdf │ ├── Exercise3-iii-shanelka.c │ ├── Exercise3-i-shanelka.c │ ├── Exercise2-iii-shanelka.c │ ├── Exercise3-ii-shanelka.c │ ├── Exercise2-i-ii-shanelka.c │ └── Exercise1-shanelka.c ├── Past Papers ├── 2017 │ └── Final Exam │ │ └── Introduction to Programming (N102).pdf ├── 2019 │ └── Final Exam │ │ └── Paper 1A │ │ ├── Answers-Léo │ │ ├── loyalty.dat │ │ ├── 1AQ2a-Léo.c │ │ ├── 1AQ4-Léo.c │ │ ├── 1AQ2b-Léo.c │ │ └── 1AQ3-Leo.c │ │ ├── Answers - Sahan │ │ ├── loyalty.dat │ │ ├── 1AQ2a-sahan.c │ │ └── 1AQ2b-sahan.c │ │ ├── IT1010_FInalPaper_2019.pdf │ │ └── Answers - Randula │ │ ├── loyalty.dat │ │ └── 2A - Randula.c ├── 2020 │ ├── September │ │ ├── Online Exam 3 │ │ │ ├── VersionE │ │ │ │ ├── Due to an error of the question here gives the two possibilities.txt │ │ │ │ ├── Version E - Online Test 03.pdf │ │ │ │ ├── Version E - Randula (Ascending).c │ │ │ │ └── Version E - Randula (Deascending).c │ │ │ ├── VersionA │ │ │ │ └── Version A - Online Test 03.pdf │ │ │ ├── VersionB │ │ │ │ └── Version B - Online Test 03.pdf │ │ │ ├── VersionC │ │ │ │ ├── Version C - Online Test 03.pdf │ │ │ │ └── Version C - Randula.c │ │ │ └── VersionD │ │ │ │ ├── Version D - Online Test 03.pdf │ │ │ │ └── Version D - Randula.c │ │ ├── Online Exam 1 │ │ │ ├── VersionA │ │ │ │ └── VersionA.pdf │ │ │ ├── VersionB │ │ │ │ └── VersionB.pdf │ │ │ ├── VersionC │ │ │ │ └── VersionC.pdf │ │ │ ├── VersionD │ │ │ │ └── VersionD.pdf │ │ │ └── VersionE │ │ │ │ └── VersionE.pdf │ │ ├── Online Exam 2 │ │ │ ├── VersionA │ │ │ │ ├── VersionA.pdf │ │ │ │ ├── Version A - Randula │ │ │ │ │ └── Q1 - Randula.c │ │ │ │ └── versionA-a-Sasitha.c │ │ │ ├── VersionB │ │ │ │ ├── VersionB.pdf │ │ │ │ ├── Version B - Randula │ │ │ │ │ └── Q1 - Randula.c │ │ │ │ └── versionB-a-Thushara.c │ │ │ ├── VersionC │ │ │ │ ├── VersionC.pdf │ │ │ │ ├── Version C - Randula │ │ │ │ │ └── Q1 - Randula.c │ │ │ │ └── versionC-a-Thushara.c │ │ │ ├── VersionD │ │ │ │ ├── VersionD.pdf │ │ │ │ └── Version D - Randula │ │ │ │ │ ├── Q1 - Randula.c │ │ │ │ │ └── Q2 - Randula.c │ │ │ └── VersionE │ │ │ │ ├── VersionE.pdf │ │ │ │ ├── Version E - Randula │ │ │ │ ├── Q2 - Randula.c │ │ │ │ └── Q1 - Randula.c │ │ │ │ └── versionE-b-Lakshan.c │ │ └── Online Exam 2 - resit │ │ │ └── Online2-resit.pdf │ └── June │ │ └── Online Exam 3 │ │ ├── VersionA │ │ ├── Version A.pdf │ │ ├── 2020 June Online 3 Version A - Randula.c │ │ └── 2020juneO3VA-Thushara.c │ │ ├── VersionB │ │ ├── Version B.pdf │ │ └── 2020 June Online 3 Version B - Randula.c │ │ ├── VersionC │ │ ├── Version C.pdf │ │ └── 2020 June Online 3 Version C - Randula.c │ │ ├── VersionD │ │ ├── Version D.pdf │ │ └── 2020 June Online 3 Version D - Randula.c │ │ └── VersionE │ │ ├── Version E.pdf │ │ └── 2020 June Online 3 Version E - Randula.c ├── 2021 Feb │ ├── Online Exam 2 │ │ ├── Version 1 - (pizzaOutlet) │ │ │ ├── V1-(pizzaOutlet) - Thushara.c │ │ │ └── Version 1 - (pizzaOutlet).png │ │ ├── Version 3 - (bowlingGame) │ │ │ └── Version 3 - (bowlingGame).jpeg │ │ ├── Version 4 - (burgerOutlet) │ │ │ ├── Version 4 - (burgerOutlet).jpeg │ │ │ └── V 4 - (burgerOutlet) - Randula.c │ │ ├── Version 2 - (purchasedItem) │ │ │ ├── Version 2 - (purchasedItem).jpeg │ │ │ └── V 2 - (purchasedItem) - Randula.c │ │ └── Version 5 - (stationaryShop) │ │ │ ├── Version 5 - (stationaryShop).jpeg │ │ │ └── V 5 - (stationaryShop) - Randula.c │ ├── Online Exam 6 │ │ ├── Version 3 - Book │ │ │ └── Version 3 - Book.jpeg │ │ ├── Version 1 - Product │ │ │ └── Version 1 - Product.jpeg │ │ └── Version 2 - Employee │ │ │ └── Version 2 - Employee.jpeg │ └── Online Exam 5 │ │ ├── Version 3 - (Boxes) │ │ └── Version3 (Boxes).jpg │ │ ├── Version 1 - (chocolate) │ │ ├── Version 1 - (chocolate).jpg │ │ └── V1-(chocolate) - Thushara.c │ │ ├── Version 4 - (Rainfall) │ │ ├── Version4(Rainfall) - Sahan.png │ │ ├── Version4(Rainfall) - Sahan.c │ │ └── Version4 (Rainfall) - Randula.c │ │ ├── Version 5 - (temperature) │ │ ├── Version 5 - (temperature).jpeg │ │ └── V5-(temperature) - Thushara.c │ │ ├── Version 2 - (Student's Final Mark) │ │ └── Version 2(Student's Final Mark).png │ │ └── Version 6 - (Rainfall in colombo and kandy) │ │ └── V 6 - (Rainfall in colombo and kandy).jpeg ├── 2018 June │ ├── Final Exam │ │ └── Paper 1A │ │ │ ├── attendance.dat │ │ │ ├── 2018 - Randula │ │ │ ├── attendance.dat │ │ │ └── 4A - Randula.c │ │ │ ├── Final Examination Past Paper_2018.pdf │ │ │ ├── Answers - Sahan │ │ │ ├── 1AJune4a - Sahan.c │ │ │ ├── 1AJune4b - Sahan.c │ │ │ ├── 1AJune1 - Sahan.c │ │ │ └── 1AJune2b - Sahan.c │ │ │ ├── 1AQ2b-Thushara.c │ │ │ ├── Answers- Léo │ │ │ ├── 1AJune2b.c │ │ │ ├── 1AJune4a.c │ │ │ └── 1AJune1.c │ │ │ ├── 1AQ4a-Thushara.c │ │ │ └── 1AQ4b-Thushara.c │ └── Online Exam 1 │ │ └── VersionB │ │ └── 2018juneO1VB.jpeg ├── 2022 June │ └── Final Exam │ │ ├── Session 1 │ │ ├── 2022-J.pdf │ │ ├── Q1-shanelka.c │ │ └── Q2-i-shanelka.c │ │ └── Session 2 │ │ ├── 2022-J IT 1010-Introduction to Programming - Session 2.pdf │ │ └── Q1-shanelka.c ├── 2018 Jan │ └── Final Exam │ │ └── Introduction to Programming C (IT1103).pdf ├── 2021 May │ └── Online Test 1 │ │ ├── Version 3 (bank) │ │ ├── Version 3 (Bank).jpeg │ │ ├── Version 3 - Randula.c │ │ ├── Version 3 - radser2001.c │ │ └── Version3 - radser2001.c │ │ ├── Version 5 (salary) │ │ ├── Version 5_salary.jpeg │ │ └── Version 5 - Randula.c │ │ ├── Version 2 (restaurant) │ │ └── Version 2_ (restaurant).jpeg │ │ ├── Version 4 (partyPackage) │ │ └── Version 4 (partyPackage).jpeg │ │ └── Version 1 (advertisement) │ │ ├── Version 1_(advertisement).jpeg │ │ └── Version 1 - Randula.c └── 2017 Jan │ └── Final Exam │ └── Introduction to Programming (CC++) (N102).pdf ├── Other Questions ├── Question 1 │ └── Q1.jpeg ├── Question 3 │ ├── Q3.jpeg │ ├── Q3-Ex2-Thushara.c │ ├── Q3-Ex1-Thushara.c │ └── Answers - Randula │ │ ├── Q3 Part 2 - Randula.c │ │ └── Q3 Part 1 - Randula.c ├── Question 7 │ └── question.jpg ├── Question 8 │ ├── Question.jpg │ ├── calculater-nestedif-shanelka.c │ └── calculater-switch-shanelka.c ├── Question 11 │ ├── VersionD (1).pdf │ └── 01.c ├── Question 12 │ ├── VersionE (1).pdf │ ├── 01.c │ └── 02.c ├── Question 9 │ ├── VersionB (1).pdf │ └── 01.c ├── Question 2 │ └── Online2VersionB.jpeg ├── Arrays │ ├── Arrays for Online exam 4.pdf │ ├── 03 │ │ └── Untitled1.c │ ├── 04 │ │ └── Untitled1.c │ ├── 01 │ │ └── Untitled1.c │ └── 02 │ │ └── Untitled1.c ├── Question 5 │ └── File Handling Assignment.jpeg ├── Question 6 │ ├── convert degrees to radian.jpg │ └── answer-shanelka.c ├── Question 4 (ATM Question) │ └── ATM Question.pdf └── Quection 10 │ └── 1.c ├── Small C Excersices ├── FizzBuzz │ ├── Example-Output.png │ └── fizzbuzz.md └── Practice C Language │ ├── Pactice C Language.pdf │ └── Answers - Randula │ ├── Excercise 3.c │ ├── Excercise 1.c │ ├── Excercise 2.c │ └── Excercise 4.c ├── Lab Sheets ├── 2020 Lab Sheets │ ├── Lab Sheet 3 │ │ ├── LabSheet3.pdf │ │ ├── Question2-Anjana.c │ │ ├── Question1-Anjana.c │ │ └── Question3-Anjana.c │ ├── Lab Sheet 4 │ │ └── LabSheet4.pdf │ ├── Lab Sheet 5 │ │ ├── LabSheet5.pdf │ │ ├── Question2-Anjana.c │ │ ├── Question1-Anjana.c │ │ └── Question3-Anjana.c │ ├── Lab Sheet 6 │ │ ├── LabSheet6.pdf │ │ ├── Question 1-Anjana.c │ │ ├── Question 2-Anjana.c │ │ └── Question 3-Anjana.c │ └── Lab Sheet 7 │ │ ├── LabSheet7.pdf │ │ ├── Student.dat │ │ ├── Question 1-Anjana.c │ │ └── Question 2-Anjana.c └── 2021 Feb Lab Sheets │ └── Lab Sheet 11 │ ├── Lab sheet 11.pdf │ ├── Lab Sheet 11 - Léo │ ├── Exercise 1 - Léo.c │ ├── Exercise 4 - Léo.c │ ├── Exercise 3 - Léo.c │ └── Exercise 5 - Léo.c │ └── Lab sheet 11 - Randula │ ├── Excercise 4 - Randula.c │ ├── Excercise 1 - Randula.c │ ├── Excercise 3 - Randula.c │ └── Excercise 5 - Randula.c ├── C-Assessments ├── Exercise 1 │ ├── code-preview.md │ ├── readme.md │ └── question-breakdown.md ├── Exercise 2 │ ├── code-preview.md │ └── readme.md ├── Exercise 3 │ ├── code-preview.md │ └── readme.md ├── Exercise 4 │ ├── code-preview.md │ └── readme.md ├── Exercise 5 │ └── code-preview.md ├── Exercise 6 │ ├── code-preview.md │ └── readme.md ├── Exercise 7 │ ├── code-preview.md │ └── readme.md ├── Exercise 8 │ ├── code-preview.md │ └── readme.md └── readme.md ├── .github └── workflows │ └── main.yml ├── .gitignore └── LICENSE /MID/Questions/Answers.docx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 12/number.dat: -------------------------------------------------------------------------------- 1 | 21 43 76 98 40 55 66 -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 10/Q1/number.txt: -------------------------------------------------------------------------------- 1 | 21 43 76 98 40 -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 12/appointment.dat: -------------------------------------------------------------------------------- 1 | qw S 2 | qw S 3 | qw S 4 | qw S 5 | qw S 6 | -------------------------------------------------------------------------------- /Past Papers/2019/Final Exam/Paper 1A/Answers-Léo/loyalty.dat: -------------------------------------------------------------------------------- 1 | 7728369210 Dinesh 2 | 7773457219 Subash 3 | -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 2/Version 1 - (pizzaOutlet)/V1-(pizzaOutlet) - Thushara.c: -------------------------------------------------------------------------------- 1 | // Example 2 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 3/VersionE/Due to an error of the question here gives the two possibilities.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/attendance.dat: -------------------------------------------------------------------------------- 1 | 1111 Thushara 1 0 1 1 0 1 0 2 | 1112 Thiwanka 0 1 0 0 1 0 1 3 | -------------------------------------------------------------------------------- /MID/Sample_MID_Exam_Questions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Sample_MID_Exam_Questions.pdf -------------------------------------------------------------------------------- /Other Questions/Question 1/Q1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Other Questions/Question 1/Q1.jpeg -------------------------------------------------------------------------------- /Other Questions/Question 3/Q3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Other Questions/Question 3/Q3.jpeg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0000.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0000.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0001.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0002.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0003.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0003.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0004.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0004.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0005.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0005.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0006.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0006.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0007.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0007.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0008.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0008.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0009.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0009.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0010.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0010.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0011.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0011.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0012.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0012.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0013.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0013.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0014.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0014.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0015.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0015.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0016.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0016.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0017.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0017.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0018.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0018.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0019.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0019.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0020.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0020.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0021.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0021.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0022.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0022.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0023.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0023.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0024.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0024.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0025.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0025.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0026.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0026.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0027.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0027.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0028.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0028.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0029.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0029.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0030.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0030.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0031.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0031.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0032.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0032.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0033.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0033.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0034.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0034.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0035.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0035.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0036.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0036.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0037.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0037.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0038.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0038.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0039.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0039.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0040.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0040.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0041.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0041.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0042.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0042.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0043.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0043.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0044.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0044.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0045.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0045.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0046.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0046.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0047.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0047.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0048.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0048.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0049.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0049.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0050.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0050.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0051.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0051.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0052.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0052.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0053.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0053.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0054.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0054.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0055.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0055.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0056.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0056.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0057.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0057.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0058.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0058.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0059.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0059.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0060.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0060.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0061.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0061.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0062.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0062.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0063.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0063.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0064.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0064.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0065.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0065.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0066.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0066.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0067.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0067.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0068.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0068.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0069.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0069.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0070.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0070.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0071.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0071.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0072.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0072.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0073.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0073.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0074.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0074.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0075.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0075.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0076.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0076.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0077.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0077.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0078.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0078.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0079.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0079.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0080.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0080.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0081.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0081.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0082.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0082.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0083.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0083.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0084.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0084.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0085.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0085.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0086.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0086.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0087.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0087.jpg -------------------------------------------------------------------------------- /MID/Questions/IMG-20201221-WA0088.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/IMG-20201221-WA0088.jpg -------------------------------------------------------------------------------- /Other Questions/Question 7/question.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Other Questions/Question 7/question.jpg -------------------------------------------------------------------------------- /Other Questions/Question 8/Question.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Other Questions/Question 8/Question.jpg -------------------------------------------------------------------------------- /Other Questions/Question 11/VersionD (1).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Other Questions/Question 11/VersionD (1).pdf -------------------------------------------------------------------------------- /Other Questions/Question 12/VersionE (1).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Other Questions/Question 12/VersionE (1).pdf -------------------------------------------------------------------------------- /Other Questions/Question 9/VersionB (1).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Other Questions/Question 9/VersionB (1).pdf -------------------------------------------------------------------------------- /MID/Introduction to Programming_Model Paper.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Introduction to Programming_Model Paper.pdf -------------------------------------------------------------------------------- /Other Questions/Question 2/Online2VersionB.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Other Questions/Question 2/Online2VersionB.jpeg -------------------------------------------------------------------------------- /Small C Excersices/FizzBuzz/Example-Output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Small C Excersices/FizzBuzz/Example-Output.png -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 4/Question1-i-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Thushara"); 6 | 7 | return 0; 8 | } -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 3/LabSheet3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Lab Sheets/2020 Lab Sheets/Lab Sheet 3/LabSheet3.pdf -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 4/LabSheet4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Lab Sheets/2020 Lab Sheets/Lab Sheet 4/LabSheet4.pdf -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 5/LabSheet5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Lab Sheets/2020 Lab Sheets/Lab Sheet 5/LabSheet5.pdf -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 6/LabSheet6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Lab Sheets/2020 Lab Sheets/Lab Sheet 6/LabSheet6.pdf -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 7/LabSheet7.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Lab Sheets/2020 Lab Sheets/Lab Sheet 7/LabSheet7.pdf -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 7/Student.dat: -------------------------------------------------------------------------------- 1 | Name Class Year GPA 2 | Nimal 1 1 3.7 3 | Sunil 1 2 4.0 4 | Kamal 3 3 2.7 5 | Mihiri 2 1 1.7 6 | Mala 2 4 2.1 -------------------------------------------------------------------------------- /Other Questions/Arrays/Arrays for Online exam 4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Other Questions/Arrays/Arrays for Online exam 4.pdf -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 10/Tutorial 10.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2020 Tutorials/Tutorial 10/Tutorial 10.pdf -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 12/Tutorial 12.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2020 Tutorials/Tutorial 12/Tutorial 12.pdf -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 4/Tutorial 4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2020 Tutorials/Tutorial 4/Tutorial 4.pdf -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 5/Tutorial 5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2020 Tutorials/Tutorial 5/Tutorial 5.pdf -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 6/Tutorial 6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2020 Tutorials/Tutorial 6/Tutorial 6.pdf -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 7/Tutorial 7.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2020 Tutorials/Tutorial 7/Tutorial 7.pdf -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 8/Tutorial 8.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2020 Tutorials/Tutorial 8/Tutorial 8.pdf -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 9/Tutorial 9.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2020 Tutorials/Tutorial 9/Tutorial 9.pdf -------------------------------------------------------------------------------- /Past Papers/2022 June/Final Exam/Session 1/2022-J.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2022 June/Final Exam/Session 1/2022-J.pdf -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 4/Question1-ii-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | printf("Welcome\nto\nSLIIT"); 6 | 7 | return 0; 8 | } -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 03/Tutorial3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2021 Feb Tutorials/TUTORIAL 03/Tutorial3.pdf -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 04/Exercise 3.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2021 Feb Tutorials/TUTORIAL 04/Exercise 3.c -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 04/Tutorial4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2021 Feb Tutorials/TUTORIAL 04/Tutorial4.pdf -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 05/Tutorial5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2021 Feb Tutorials/TUTORIAL 05/Tutorial5.pdf -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 06/Tutorial6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2021 Feb Tutorials/TUTORIAL 06/Tutorial6.pdf -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 07/Exercise 1.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2021 Feb Tutorials/TUTORIAL 07/Exercise 1.c -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 07/Tutorial7.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2021 Feb Tutorials/TUTORIAL 07/Tutorial7.pdf -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 08/Tutorial8.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2021 Feb Tutorials/TUTORIAL 08/Tutorial8.pdf -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 09/Tutorial9.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2021 Feb Tutorials/TUTORIAL 09/Tutorial9.pdf -------------------------------------------------------------------------------- /Tutorials/2022 Oct Tutorials/Turorial 05/Tutorial5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2022 Oct Tutorials/Turorial 05/Tutorial5.pdf -------------------------------------------------------------------------------- /Other Questions/Question 5/File Handling Assignment.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Other Questions/Question 5/File Handling Assignment.jpeg -------------------------------------------------------------------------------- /Other Questions/Question 6/convert degrees to radian.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Other Questions/Question 6/convert degrees to radian.jpg -------------------------------------------------------------------------------- /Past Papers/2019/Final Exam/Paper 1A/Answers - Sahan/loyalty.dat: -------------------------------------------------------------------------------- 1 | 7728369210 Dinesh 2 | 7773457219 Subash 3 | 778635445 Sahan 4 | 715818781 Kamal 5 | 711398019 Kumari 6 | -------------------------------------------------------------------------------- /Tutorials/2022 Oct Tutorials/Tutorial 01/Tutorial 1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Tutorials/2022 Oct Tutorials/Tutorial 01/Tutorial 1.pdf -------------------------------------------------------------------------------- /Other Questions/Question 4 (ATM Question)/ATM Question.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Other Questions/Question 4 (ATM Question)/ATM Question.pdf -------------------------------------------------------------------------------- /Past Papers/2020/June/Online Exam 3/VersionA/Version A.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/June/Online Exam 3/VersionA/Version A.pdf -------------------------------------------------------------------------------- /Past Papers/2020/June/Online Exam 3/VersionB/Version B.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/June/Online Exam 3/VersionB/Version B.pdf -------------------------------------------------------------------------------- /Past Papers/2020/June/Online Exam 3/VersionC/Version C.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/June/Online Exam 3/VersionC/Version C.pdf -------------------------------------------------------------------------------- /Past Papers/2020/June/Online Exam 3/VersionD/Version D.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/June/Online Exam 3/VersionD/Version D.pdf -------------------------------------------------------------------------------- /Past Papers/2020/June/Online Exam 3/VersionE/Version E.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/June/Online Exam 3/VersionE/Version E.pdf -------------------------------------------------------------------------------- /Lab Sheets/2021 Feb Lab Sheets/Lab Sheet 11/Lab sheet 11.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Lab Sheets/2021 Feb Lab Sheets/Lab Sheet 11/Lab sheet 11.pdf -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/2018 - Randula/attendance.dat: -------------------------------------------------------------------------------- 1 | 111 Perera 1 0 1 1 0 1 1 2 | 112 Silva 1 0 1 1 0 0 0 3 | 113 John 1 1 1 1 1 0 0 4 | 555 nick 1 1 0 1 1 1 0 -------------------------------------------------------------------------------- /Past Papers/2018 June/Online Exam 1/VersionB/2018juneO1VB.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2018 June/Online Exam 1/VersionB/2018juneO1VB.jpeg -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 1/VersionA/VersionA.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 1/VersionA/VersionA.pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 1/VersionB/VersionB.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 1/VersionB/VersionB.pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 1/VersionC/VersionC.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 1/VersionC/VersionC.pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 1/VersionD/VersionD.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 1/VersionD/VersionD.pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 1/VersionE/VersionE.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 1/VersionE/VersionE.pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionA/VersionA.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 2/VersionA/VersionA.pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionB/VersionB.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 2/VersionB/VersionB.pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionC/VersionC.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 2/VersionC/VersionC.pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionD/VersionD.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 2/VersionD/VersionD.pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionE/VersionE.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 2/VersionE/VersionE.pdf -------------------------------------------------------------------------------- /Small C Excersices/Practice C Language/Pactice C Language.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Small C Excersices/Practice C Language/Pactice C Language.pdf -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-14 at 12.57.54 AM.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-14 at 12.57.54 AM.jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.30.29 AM.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.30.29 AM.jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.30.59 AM.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.30.59 AM.jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.31.21 AM.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.31.21 AM.jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.31.55 AM.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.31.55 AM.jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.31.56 AM.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.31.56 AM.jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.32.23 AM.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.32.23 AM.jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.32.37 AM.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.32.37 AM.jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.34.23 AM.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.34.23 AM.jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.39.38 AM.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.39.38 AM.jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.41.31 AM.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.41.31 AM.jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.57.11 AM.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.57.11 AM.jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.57.27 AM.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.57.27 AM.jpeg -------------------------------------------------------------------------------- /Past Papers/2019/Final Exam/Paper 1A/IT1010_FInalPaper_2019.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2019/Final Exam/Paper 1A/IT1010_FInalPaper_2019.pdf -------------------------------------------------------------------------------- /Past Papers/2017/Final Exam/Introduction to Programming (N102).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2017/Final Exam/Introduction to Programming (N102).pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2 - resit/Online2-resit.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 2 - resit/Online2-resit.pdf -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.31.56 AM (1).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.31.56 AM (1).jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.31.56 AM (2).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.31.56 AM (2).jpeg -------------------------------------------------------------------------------- /MID/Questions/june/WhatsApp Image 2020-12-22 at 12.32.23 AM (1).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/MID/Questions/june/WhatsApp Image 2020-12-22 at 12.32.23 AM (1).jpeg -------------------------------------------------------------------------------- /Past Papers/2019/Final Exam/Paper 1A/Answers - Randula/loyalty.dat: -------------------------------------------------------------------------------- 1 | 7728369210 Dinesh 2 | 7773457219 Subash 3 | 1 1 4 | 2 2 5 | 3 3 6 | 4 4 7 | 5 5 8 | 123 Logan 9 | 56 basic 10 | 4563 kamal 11 | -------------------------------------------------------------------------------- /Past Papers/2018 Jan/Final Exam/Introduction to Programming C (IT1103).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2018 Jan/Final Exam/Introduction to Programming C (IT1103).pdf -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 6/Version 3 - Book/Version 3 - Book.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 6/Version 3 - Book/Version 3 - Book.jpeg -------------------------------------------------------------------------------- /Past Papers/2021 May/Online Test 1/Version 3 (bank)/Version 3 (Bank).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 May/Online Test 1/Version 3 (bank)/Version 3 (Bank).jpeg -------------------------------------------------------------------------------- /Past Papers/2017 Jan/Final Exam/Introduction to Programming (CC++) (N102).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2017 Jan/Final Exam/Introduction to Programming (CC++) (N102).pdf -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 5/Version 3 - (Boxes)/Version3 (Boxes).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 5/Version 3 - (Boxes)/Version3 (Boxes).jpg -------------------------------------------------------------------------------- /Past Papers/2021 May/Online Test 1/Version 5 (salary)/Version 5_salary.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 May/Online Test 1/Version 5 (salary)/Version 5_salary.jpeg -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/Final Examination Past Paper_2018.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2018 June/Final Exam/Paper 1A/Final Examination Past Paper_2018.pdf -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 6/Version 1 - Product/Version 1 - Product.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 6/Version 1 - Product/Version 1 - Product.jpeg -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 3/VersionA/Version A - Online Test 03.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 3/VersionA/Version A - Online Test 03.pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 3/VersionB/Version B - Online Test 03.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 3/VersionB/Version B - Online Test 03.pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 3/VersionC/Version C - Online Test 03.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 3/VersionC/Version C - Online Test 03.pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 3/VersionD/Version D - Online Test 03.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 3/VersionD/Version D - Online Test 03.pdf -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 3/VersionE/Version E - Online Test 03.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2020/September/Online Exam 3/VersionE/Version E - Online Test 03.pdf -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 6/Version 2 - Employee/Version 2 - Employee.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 6/Version 2 - Employee/Version 2 - Employee.jpeg -------------------------------------------------------------------------------- /C-Assessments/Exercise 1/code-preview.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | 6 |

7 | 8 |

-------------------------------------------------------------------------------- /C-Assessments/Exercise 2/code-preview.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | 6 |

7 | 8 |

-------------------------------------------------------------------------------- /C-Assessments/Exercise 3/code-preview.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | 6 |

7 | 8 |

-------------------------------------------------------------------------------- /C-Assessments/Exercise 4/code-preview.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | 6 |

7 | 8 |

-------------------------------------------------------------------------------- /C-Assessments/Exercise 5/code-preview.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | 6 |

7 | 8 |

-------------------------------------------------------------------------------- /C-Assessments/Exercise 6/code-preview.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | 6 |

7 | 8 |

-------------------------------------------------------------------------------- /C-Assessments/Exercise 7/code-preview.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | 6 |

7 | 8 |

-------------------------------------------------------------------------------- /C-Assessments/Exercise 8/code-preview.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | 6 |

7 | 8 |

-------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 5/Version 1 - (chocolate)/Version 1 - (chocolate).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 5/Version 1 - (chocolate)/Version 1 - (chocolate).jpg -------------------------------------------------------------------------------- /Past Papers/2021 May/Online Test 1/Version 2 (restaurant)/Version 2_ (restaurant).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 May/Online Test 1/Version 2 (restaurant)/Version 2_ (restaurant).jpeg -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 5/Version 4 - (Rainfall)/Version4(Rainfall) - Sahan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 5/Version 4 - (Rainfall)/Version4(Rainfall) - Sahan.png -------------------------------------------------------------------------------- /Past Papers/2021 May/Online Test 1/Version 4 (partyPackage)/Version 4 (partyPackage).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 May/Online Test 1/Version 4 (partyPackage)/Version 4 (partyPackage).jpeg -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 2/Version 1 - (pizzaOutlet)/Version 1 - (pizzaOutlet).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 2/Version 1 - (pizzaOutlet)/Version 1 - (pizzaOutlet).png -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 2/Version 3 - (bowlingGame)/Version 3 - (bowlingGame).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 2/Version 3 - (bowlingGame)/Version 3 - (bowlingGame).jpeg -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 5/Version 5 - (temperature)/Version 5 - (temperature).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 5/Version 5 - (temperature)/Version 5 - (temperature).jpeg -------------------------------------------------------------------------------- /Past Papers/2021 May/Online Test 1/Version 1 (advertisement)/Version 1_(advertisement).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 May/Online Test 1/Version 1 (advertisement)/Version 1_(advertisement).jpeg -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 2/Version 4 - (burgerOutlet)/Version 4 - (burgerOutlet).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 2/Version 4 - (burgerOutlet)/Version 4 - (burgerOutlet).jpeg -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 2/Version 2 - (purchasedItem)/Version 2 - (purchasedItem).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 2/Version 2 - (purchasedItem)/Version 2 - (purchasedItem).jpeg -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 2/Version 5 - (stationaryShop)/Version 5 - (stationaryShop).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 2/Version 5 - (stationaryShop)/Version 5 - (stationaryShop).jpeg -------------------------------------------------------------------------------- /Past Papers/2022 June/Final Exam/Session 2/2022-J IT 1010-Introduction to Programming - Session 2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2022 June/Final Exam/Session 2/2022-J IT 1010-Introduction to Programming - Session 2.pdf -------------------------------------------------------------------------------- /Other Questions/Question 9/01.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i,j; 6 | 7 | for(i=97;i<=101;i++) 8 | { 9 | for(j=101;j>=i;j--) 10 | { 11 | printf(" %c",i); 12 | } 13 | printf("\n"); 14 | } 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 5/Version 2 - (Student's Final Mark)/Version 2(Student's Final Mark).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 5/Version 2 - (Student's Final Mark)/Version 2(Student's Final Mark).png -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 5/Version 6 - (Rainfall in colombo and kandy)/V 6 - (Rainfall in colombo and kandy).jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThusharaX/C-programming/HEAD/Past Papers/2021 Feb/Online Exam 5/Version 6 - (Rainfall in colombo and kandy)/V 6 - (Rainfall in colombo and kandy).jpeg -------------------------------------------------------------------------------- /Tutorials/2022 Oct Tutorials/Turorial 05/E01-i-Shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int i = 10; 5 | 6 | // while loop for print numbers 7 | while (i <= 20) { 8 | printf("%d\n", i); 9 | i++; 10 | 11 | } 12 | return 0; 13 | } // end of main -------------------------------------------------------------------------------- /Other Questions/Quection 10/1.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | 4 | int i,j,k; 5 | 6 | for(i=1;i<=2;i++) 7 | { 8 | for(j=1;j<=2;j++) 9 | { 10 | for(k=1;k<=2;k++) 11 | { 12 | printf("[%d %d %d]\n",i,j,k); 13 | } 14 | 15 | } 16 | 17 | } 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 3/Question2-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int n,s=1; 6 | printf("Enter n: "); 7 | scanf("%d",&n); 8 | 9 | while(n>0){ 10 | s*=n; 11 | n--; 12 | } 13 | 14 | printf("%d",s); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /Other Questions/Question 11/01.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i,j,k; //variable declaration 5 | 6 | for(i=2;i>=1;i--) 7 | { 8 | for(j=2;j>=1;j--) 9 | { 10 | for(k=2;k>=1;k--) 11 | { 12 | printf("[%d %d %d]\n",i,j,k); 13 | } 14 | } 15 | } 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 5/Question4-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { int a; 7 | printf("Enter Time in Seconds: "); 8 | scanf(" %d",&a); 9 | printf("HH:%d MM:%d SS:%d\n",a/3600,(a%3600)/60,a%60); 10 | 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 5/Question2-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int A[]={10, 20, 30, 40, 50}; 6 | int B[]= {34, 67, 12, 89, 12}; 7 | int C[5]; 8 | 9 | for(int i=0;i<5;i++){ 10 | C[i]=A[i]*B[i]; 11 | } 12 | 13 | return 0; 14 | } 15 | 16 | 17 | -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 3/Question1-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a; 6 | printf("N\t10*N\t100*N\t1000*N\n"); 7 | 8 | for(int i=0;i<10;i++){ 9 | a=i+1; 10 | printf("%d\t%d\t%d\t%d\n",a,a*10,a*100,a*1000); 11 | } 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 5/Additional Exercises/Question5-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | int n; 8 | 9 | printf("Enter n: "); 10 | scanf(" %d",&n); 11 | int sum = n*(n+1)*0.5; 12 | printf("SUM : %d: ", sum ); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /C-Assessments/readme.md: -------------------------------------------------------------------------------- 1 | 2 | ## C-Assessments 📰 3 | 4 | * C Assessment answers by [Shalinda Fernando](https://github.com/shafdo). 5 | 6 | * You can find more infomation on a personal repo I created: [https://github.com/shafdo/IP-PREP](https://github.com/shafdo/IP-PREP) 7 | 8 | * My GitHub profile: [https://github.com/shafdo](https://github.com/shafdo) -------------------------------------------------------------------------------- /Past Papers/2019/Final Exam/Paper 1A/Answers - Sahan/1AQ2a-sahan.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i; 5 | int fib[10]; 6 | 7 | fib[0] = 0; 8 | fib[1] = 1; 9 | 10 | for(i=2; i<10; ++i) 11 | { 12 | fib[i] = fib[i-2] + fib[i-1]; 13 | } 14 | 15 | for(i=0; i<10; ++i) 16 | printf("%d ", fib[i]); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Past Papers/2019/Final Exam/Paper 1A/Answers-Léo/1AQ2a-Léo.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int fib[10]; 6 | fib[0]=0; 7 | fib[1]=1; 8 | int i,res; 9 | 10 | for(i=2;i<=9;i++) 11 | { 12 | res = fib[i-2]+fib[i-1]; 13 | fib[i] = res; 14 | } 15 | for(i=0;i<=9;i++) 16 | { 17 | printf("%d\t",fib[i]); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 6/Question2-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | int a; 8 | printf("Enter a number: "); 9 | scanf("%d",&a); 10 | 11 | if(a%2==0) 12 | printf("even number"); 13 | else 14 | printf("odd number"); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 5/Additional Exercises/Question6-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | int d; 7 | 8 | printf("Enter 5 digit number: "); 9 | scanf(" %d",&d); 10 | printf("%d %d %d %d %d",d/10000,(d%10000)/1000,(d%1000)/100,(d%100)/10,d%10 ); 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /Small C Excersices/Practice C Language/Answers - Randula/Excercise 3.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | int n , sum = 0 , i; 6 | 7 | printf("Enter a value for 'n' : "); 8 | scanf("%d" , &n); 9 | 10 | for (i = 1 ; i <= n ; i++) 11 | { 12 | sum += i; 13 | } 14 | 15 | printf("sum = %d\n" , sum); 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Lab Sheets/2021 Feb Lab Sheets/Lab Sheet 11/Lab Sheet 11 - Léo/Exercise 1 - Léo.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int x,facto=1; 6 | 7 | printf("Enter Number: "); 8 | scanf("%d",&x); 9 | 10 | printf("Factorial of %d is: ",x); 11 | 12 | while(x!=0) 13 | { 14 | facto *= x; 15 | x--; 16 | } 17 | 18 | printf("%d",facto); 19 | } 20 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionB/Version B - Randula/Q1 - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | int i , j , k = 0; 6 | 7 | for (i = 5 ; i >= 1 ; i--) 8 | { 9 | for (j = 1 ; j <= i ; j++) 10 | { 11 | printf("%c" , 97 + k); 12 | } 13 | k++; 14 | printf("\n"); 15 | } 16 | 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Other Questions/Question 3/Q3-Ex2-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | 5 | char name[10]; 6 | int bYear; 7 | 8 | printf("Name : "); 9 | scanf("%s", name); 10 | 11 | printf("Year of Birth : "); 12 | scanf("%d", &bYear); 13 | 14 | printf("Hey %s!!! You are %d years old. Great", name, 2021-bYear); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /Tutorials/2022 Oct Tutorials/Turorial 05/E01-ii-Shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // without arrays 4 | int main() { // start the main 5 | int num = 1; 6 | while(num > 0) { 7 | printf("Enter Number : "); 8 | scanf("%d", &num); 9 | if (num > 0) 10 | printf("You Entered Number %d\n", num); 11 | } 12 | return 0; 13 | } -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 6/Question 1-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int c=20; 6 | char n[20]={0}; 7 | scanf("%s",&n); 8 | 9 | while(c>=0){ 10 | if(n[c]!='\0'){//ignore zero null values in array 11 | printf("%c",n[c]); 12 | } 13 | c--; 14 | } 15 | 16 | return 0; 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 4/Question3-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int num1, num2, total; 6 | 7 | printf("Enter Number 1 : "); 8 | scanf("%d", &num1); 9 | printf("Enter Number 2 : "); 10 | scanf("%d", &num2); 11 | 12 | total = num1 + num2; 13 | 14 | printf("Total : "); 15 | printf("%d", total); 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Small C Excersices/FizzBuzz/fizzbuzz.md: -------------------------------------------------------------------------------- 1 | ## Write a FizzBuzz implementation in C. 2 | 3 | for multiples of three, Print “Fizz” instead of the number, and for multiples of five, Print “Buzz.” Print “FizzBuzz” for numbers that are multiples of three and five. 4 | 5 | number/3 = 0 -> Print Fizz 6 | number/5 = 0 -> Print Buzz 7 | number/3 & number/5 = 0 -> Print FizzBuzz 8 | 9 | 10 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 5/Question3-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { float a; 7 | printf("Enter radius: "); 8 | scanf(" %f",&a); 9 | printf("diameter: %.2f\n",a*2); 10 | printf("circumference: %.2f\n",(a*2*22/7)); 11 | printf("area: %.2f\n",pow(a,2)*22/7); 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 6/Question7-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | int c; 8 | int s; 9 | 10 | printf("Enter Employee category: "); 11 | scanf(" %d",&c); 12 | printf("Enter Employee Salary: "); 13 | scanf(" %d",&s); 14 | 15 | printf("Bonus :%.2f", 0.05*c*s ); 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 6/Question 2-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a=0,b; 6 | char c[100]; 7 | scanf("%s",&c); 8 | 9 | while(c[a]!='\0'){//only work for a single word, stop when meets a null value or a space 10 | b=c[a]; 11 | printf("%c",b-32); 12 | a++; 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionC/Version C - Randula/Q1 - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | int i, r, p, value = 2; 6 | 7 | for (i = 1; i <= value; i++) 8 | { 9 | for (r = 1; r <= value; r++) 10 | { 11 | for (p = 1; p <= value; p++) 12 | { 13 | printf("[%d %d %d]\n", i, r, p); 14 | } 15 | } 16 | } 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionD/Version D - Randula/Q1 - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | int i, r, p, value = 1; 6 | 7 | for (i = 2; i >= value; i--) 8 | { 9 | for (r = 2; r >= value; r--) 10 | { 11 | for (p = 2; p >= value; p--) 12 | { 13 | printf("[%d %d %d]\n", i, r, p); 14 | } 15 | } 16 | } 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 6/Question3-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | int a; 8 | printf("Enter a number: "); 9 | scanf("%d",&a); 10 | 11 | if( ((a/10000)==(a%10)) && ( ((a%10000)/1000) ==((a%100)/10) ) ) 12 | printf("Palindrome "); 13 | else 14 | printf("Not Palindrome"); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /Small C Excersices/Practice C Language/Answers - Randula/Excercise 1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | int no1 , no2; 6 | float average; 7 | 8 | printf("Enter Number 1 and Number: "); 9 | scanf("%d %d" , &no1 , &no2); 10 | 11 | average = (float) (no1 + no2) / 2; 12 | 13 | printf("\n"); 14 | printf("The Average is : %.2f\n" , average); 15 | 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 12/Question1.(d)-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | char c[30]; 6 | 7 | FILE *fptr; 8 | fptr = fopen("number.dat","r"); 9 | 10 | if(fptr==NULL) 11 | { 12 | printf("Error opening file"); 13 | return -1; 14 | } 15 | 16 | fgets(c,30,fptr); 17 | printf("%s",c); 18 | 19 | fclose(fptr); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 5/Additional Exercises/Question4-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | float w; 8 | float h; 9 | 10 | printf("Enter Weight in KG: "); 11 | scanf(" %f",&w); 12 | printf("Enter Height in M: "); 13 | scanf(" %f",&h); 14 | 15 | printf("BMI : %.2f: ",(w/pow(h,2)) ); 16 | 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 6/Question1-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | int a; 8 | printf("Enter a number: "); 9 | scanf("%d",&a); 10 | 11 | if(a>0) 12 | printf("number is positive"); 13 | else if(a==0) 14 | printf("number is zero"); 15 | else 16 | printf("number is negative"); 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Lab Sheets/2021 Feb Lab Sheets/Lab Sheet 11/Lab Sheet 11 - Léo/Exercise 4 - Léo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main() 4 | { 5 | char name[20]; 6 | int len,i; 7 | 8 | printf("Enter the name: "); 9 | scanf("%s",name); 10 | len = strlen(name); 11 | 12 | printf("\nName in backwards: "); 13 | for(i=0;i<=len-1;i++) 14 | { 15 | printf("%c",name[(len-1)-i]); 16 | } 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 10/Additional Exercises/Question2-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | int main() 5 | { 6 | int ar[]={19,3,15,7,11,9,13,5,17,1}; 7 | printf("Element Value \tHistogram\n"); 8 | 9 | for(int i=0; i<10; ++i){ 10 | printf("%d \t%d\t",i,ar[i]); 11 | 12 | for(int j = ar[i];j>0;j--) 13 | printf("*"); 14 | 15 | printf("\n"); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 6/Question 3-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a=0; 6 | int arr1[3][3]; 7 | int arr2[3][3]; 8 | 9 | for(int i=0;i<3;i++){//storing to arr1 10 | for(int j=0;j<3;j++){ 11 | scanf("%d",&arr1[i][j]); 12 | arr2[j][i]= arr1[i][j];//storing the transpose of arr1 to arr2 13 | } 14 | } 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionA/Version A - Randula/Q1 - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | //variables 6 | int i , j , letter; 7 | 8 | //for loop for rows 9 | for(i = 1 ; i <= 5 ; i++) 10 | { 11 | //for loop for colunms 12 | for (j = 1 ; j <= i ; j++) 13 | { 14 | printf("%c" , 97 + i - 1); //print the letters 15 | } 16 | printf("\n"); 17 | } 18 | 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 05/Exercise 1 A.c: -------------------------------------------------------------------------------- 1 | //Exercise 1: Practice to write while loops 2 | 3 | #include 4 | int main(void) 5 | {//function main begins 6 | int counter=10;// initialization 7 | while (counter<=20){//repetition condition 8 | 9 | printf("%d\n",counter);// display counter 10 | ++counter;// increment 11 | 12 | }//end while 13 | 14 | 15 | return 0; 16 | 17 | }//end main of the function 18 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionA/versionA-a-Sasitha.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | //Declaring variables 6 | int a=0,b=0; 7 | //For loop 01 8 | for(a=1; a<6; ++a){ 9 | //For loop 02 10 | for(b=1; b<=a; ++b){ 11 | printf("%c ",a+96); 12 | } 13 | //End of For loop 02 14 | printf("\n"); 15 | } 16 | //End of For loop 01 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 4/Question4-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | float balance, annualInterest, newBalance; 6 | 7 | printf("Enter Account Balance : "); 8 | scanf("%f", &balance); 9 | 10 | annualInterest = balance * 10 / 100; 11 | printf("Annual interest : %.2f\n", annualInterest); 12 | 13 | newBalance = balance + annualInterest; 14 | printf("New Balance : %.2f", newBalance); 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 5/Additional Exercises/Question2-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | 8 | int a; 9 | int t=0; 10 | int i; 11 | 12 | for(i = 1; i < 4; i++) { 13 | printf("Enter fee for bus %d: ",i); 14 | scanf("%d", &a); 15 | t += a; 16 | } 17 | 18 | printf(" traveling expenditure for the semester %d: ",t*2*120); 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 5/Additional Exercises/Question3-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | int p; 8 | int d; 9 | float r; 10 | 11 | printf("Enter Principal: "); 12 | scanf("%d",&p); 13 | printf("Enter rate: "); 14 | scanf("%f",&r); 15 | printf("Enter no of days: "); 16 | scanf("%d",&d); 17 | 18 | printf("Interest : %.2f: ",(p*d*r/365)); 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 10/Additional Exercises/Question1-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | int main() 5 | { 6 | int numbers[5],a=0; 7 | 8 | for(int i=0; i<5; ++i){ 9 | printf("Enter number%d: ",i+1); 10 | scanf("%d", &numbers[i]); 11 | } 12 | 13 | for(int j=0;j<5;j++){ 14 | if(a 2 | 3 | int main() 4 | { 5 | char n[10]; 6 | char d; 7 | 8 | FILE *fptr; 9 | fptr = fopen("appointment.dat","w+"); 10 | 11 | for(int i=0;i<5;i++){ 12 | printf("Name: "); 13 | scanf(" %s",&n); 14 | printf("Type: "); 15 | scanf(" %c",&d); 16 | fprintf(fptr,"%s\t%c\n",n,d); 17 | } 18 | 19 | fclose(fptr); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Other Questions/Question 3/Q3-Ex1-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) { 5 | 6 | char address[200]; 7 | int i; 8 | int len; 9 | 10 | printf("Input : "); 11 | gets(address); 12 | 13 | len = strlen(address); 14 | 15 | printf("Output : \n\n"); 16 | for(i = 0; i < len; i++) { 17 | if (address[i] == ',') { 18 | printf(",\n"); 19 | } 20 | else { 21 | printf("%c", address[i]); 22 | } 23 | } 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /Small C Excersices/Practice C Language/Answers - Randula/Excercise 2.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main () 4 | { 5 | float distance , amount = 0; 6 | 7 | printf("Enter the Distance : "); 8 | scanf("%f" , &distance); 9 | 10 | if (distance <= 30) 11 | { 12 | amount = distance * 50; 13 | } 14 | else 15 | { 16 | amount = (30 * 50) + ( (distance - 30) * 40); 17 | } 18 | 19 | printf("\n"); 20 | printf("Amount : %.2f\n" , amount); 21 | 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 8/Question2-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float circleArea(float r);//function intilaization 5 | int main() 6 | { 7 | float r; 8 | printf("Enter Radius: "); 9 | scanf("%f",&r); 10 | 11 | float a = circleArea(r);//calling function and assign return value to a. 12 | printf("Area: %.2f",a); 13 | 14 | return 0; 15 | } 16 | 17 | float circleArea(float r){ 18 | return( pow(r,2)*22/7 ); 19 | } 20 | -------------------------------------------------------------------------------- /Lab Sheets/2021 Feb Lab Sheets/Lab Sheet 11/Lab Sheet 11 - Léo/Exercise 3 - Léo.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int A[5]={10,20,30,40,50}; 6 | int B[5]={34,67,12,89,12}; 7 | int C[5],i; 8 | 9 | for(i=0;i<=4;i++) 10 | { 11 | C[i]=((A[i])*(B[i])); 12 | } 13 | 14 | printf("\nArray C= "); 15 | printf("{"); 16 | for(i=0;i<=4;i++) 17 | { 18 | printf("%d",C[i]); 19 | if(i==4) 20 | { 21 | break; 22 | } 23 | printf(","); 24 | } 25 | printf("}\n"); 26 | } 27 | -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 3/Question3-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | char a='*'; 6 | 7 | ///(a) 8 | for(int i=0;i<10;i++){ 9 | for(int j=i+1;j>0;j--) 10 | printf("%c",a); 11 | printf("\n"); 12 | } 13 | 14 | printf("\n"); 15 | 16 | ///(b) 17 | for(int i=0;i<10;i++){ 18 | for(int j=10-i;j>0;j--) 19 | printf("%c",a); 20 | printf("\n"); 21 | } 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 6/Question6-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | char grade; 8 | printf("Enter Grade: "); 9 | scanf(" %c",&grade); 10 | 11 | 12 | if( grade=='A' ) 13 | printf("Excellent"); 14 | else if( grade=='B') 15 | printf("Good"); 16 | else if( (grade=='C' || grade=='c') ) 17 | printf("OK"); 18 | else 19 | printf("Needs Improvement"); 20 | 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 08/Exercise 1 A.c: -------------------------------------------------------------------------------- 1 | /*Exercise 1: Practice to store and print data in an array 2 | ex a */ 3 | 4 | #include 5 | int main( void ) 6 | {//function main begins 7 | int counter; 8 | float marks[10]; 9 | 10 | 11 | for( counter = 0 ; counter < 10 ; ++counter ){ 12 | 13 | printf( "Input Mark %d : ", counter );//prompt 14 | scanf("%f", &marks[counter]);//read marks from user 15 | 16 | } 17 | 18 | return 0; 19 | }// end of the main function 20 | -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 5/Question1-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a[]={25, 32, 45, 2, 13, 9, 6, 10, 17, 4}; 6 | int b; 7 | int c=0; 8 | printf("Enter Number: "); 9 | scanf("%d",&b); 10 | 11 | for(int i=0;i<10;i++){ 12 | if(a[i]==b){ 13 | c=i; 14 | break; 15 | } 16 | } 17 | 18 | c>0 ? printf("Location in array: %d",c):printf("Value not found"); 19 | 20 | return 0; 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionC/versionC-a-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Online Test2 - Version C - a 4 | 5 | // main function 6 | int main(void) 7 | { 8 | // variable declaration 9 | int i, r, p, value = 2; 10 | 11 | // nested loop 12 | for (i = 1; i <= value; i++) { 13 | for (r = 1; r <= value; r++) { 14 | for (p = 1; p <= value; p++) { 15 | // print 16 | printf("[%d %d %d]\n", i, r, p); 17 | } 18 | } 19 | } 20 | 21 | return 0; 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 7/Additional Exercises/Question1-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | int i; 8 | 9 | //a) 10 | for(i=1;i<8;i++) 11 | printf("%d ",i); 12 | 13 | 14 | printf("\n"); //New line 15 | 16 | //b) 17 | for(i=3;i<25;i+=5) 18 | printf("%d ",i); 19 | 20 | printf("\n"); //New line 21 | 22 | //c) 23 | for(i=20;i>(-11);i-=6) 24 | printf("%d ",i); 25 | 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /Tutorials/2022 Oct Tutorials/Tutorial 01/Exercise3-iii-shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // start the main function 4 | int main(void) { 5 | float basicSalary, bonus; // variable declaration 6 | 7 | // get and assign basic salary 8 | printf("Enter Basic Salary : "); 9 | scanf("%f", &basicSalary); 10 | 11 | // calculate bonus 12 | bonus = basicSalary * (20 / 100.0); 13 | 14 | // display output 15 | printf("Your bonus = %.2f", bonus); 16 | 17 | return 0; 18 | 19 | } // end of main -------------------------------------------------------------------------------- /Past Papers/2019/Final Exam/Paper 1A/Answers - Randula/2A - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | int fib[10] , i , store; 6 | 7 | fib[0] = 0; 8 | fib[1] = 1; 9 | 10 | for (i = 2 ; i <= 10 ; i++) 11 | { 12 | fib[i] = fib[i - 2] + fib[i - 1]; 13 | } 14 | 15 | for (i = 2 ; i <= 10 ; i++) 16 | { 17 | printf("Fib[%d] = Fib[%d] + Fib[%d]\t" , i , i - 2 , i - 1); 18 | printf("%d = %d + %d\n" , fib[i] , fib[i - 2] , fib[i - 1]); 19 | printf("\n"); 20 | } 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 06/EX 1/Exercise 1 Practice to use math library functions 1.c: -------------------------------------------------------------------------------- 1 | /*Exercise 1 Practice to use math library functions 2 | Show the value of x after each of the following statements is performed: 3 | i. x = floor(7.5) 4 | ii. x = ceil (0.0) 5 | iii. x = ceil (-6.4) 6 | iv. x = log10(100.0) 7 | v. x = ceil (floor (-5.5)) */ 8 | 9 | #include 10 | #include 11 | int main(void) 12 | { 13 | printf("%.2f",floor(7.5)); 14 | 15 | return 0; 16 | }//end of the main function 17 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 06/EX 1/Exercise 1 Practice to use math library functions 2.c: -------------------------------------------------------------------------------- 1 | /*Exercise 1 Practice to use math library functions 2 | Show the value of x after each of the following statements is performed: 3 | i. x = floor(7.5) 4 | ii. x = ceil (0.0) 5 | iii. x = ceil (-6.4) 6 | iv. x = log10(100.0) 7 | v. x = ceil (floor (-5.5)) */ 8 | 9 | #include 10 | #include 11 | int main(void) 12 | { 13 | printf("%.2f",ceil (0.0)); 14 | 15 | return 0; 16 | }//end of the main function 17 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 06/EX 1/Exercise 1 Practice to use math library functions 3.c: -------------------------------------------------------------------------------- 1 | /*Exercise 1 Practice to use math library functions 2 | Show the value of x after each of the following statements is performed: 3 | i. x = floor(7.5) 4 | ii. x = ceil (0.0) 5 | iii. x = ceil (-6.4) 6 | iv. x = log10(100.0) 7 | v. x = ceil (floor (-5.5)) */ 8 | 9 | #include 10 | #include 11 | int main(void) 12 | { 13 | printf("%.2f",ceil (-6.4)); 14 | 15 | return 0; 16 | }//end of the main function 17 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 06/EX 1/Exercise 1 Practice to use math library functions 4.c: -------------------------------------------------------------------------------- 1 | /*Exercise 1 Practice to use math library functions 2 | Show the value of x after each of the following statements is performed: 3 | i. x = floor(7.5) 4 | ii. x = ceil (0.0) 5 | iii. x = ceil (-6.4) 6 | iv. x = log10(100.0) 7 | v. x = ceil (floor (-5.5)) */ 8 | 9 | #include 10 | #include 11 | int main(void) 12 | { 13 | printf("%.2f",log10(100.0)); 14 | 15 | return 0; 16 | }//end of the main function 17 | -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 7/Question 1-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | char name[20],clas; 6 | int year; 7 | float GPA; 8 | 9 | FILE *fptr; 10 | fptr = fopen("Student.dat","w"); 11 | 12 | fprintf(fptr,"Name\tClass\tYear\tGPA\n"); 13 | 14 | for(int i=0;i<5;i++){ 15 | scanf("%s %c %d %f", &name, &clas, &year, &GPA); 16 | fprintf(fptr, "%s\t%c\t%d\t%.1f \n", name, clas, year, GPA); 17 | } 18 | 19 | fclose(fptr); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 11/Question1-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | int main() 5 | { 6 | int a=1; 7 | 8 | char w[20]; 9 | printf("enter a word: "); 10 | scanf("%s", &w); 11 | int l = strlen(w); 12 | 13 | for(int i=0;i<(l/2);i++){ 14 | if(w[i]==w[(l-1)-i]){ 15 | 16 | }else 17 | a=0; 18 | break; 19 | } 20 | 21 | a == 1 ? printf( "%s is a palindrome",w ) : printf( "%s is a not a palindrome",w ); 22 | 23 | return 0; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 6/Question4-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | char a; 8 | printf("Enter Grade: "); 9 | scanf(" %c",&a); 10 | 11 | if( a=='A' || a=='a' ) 12 | printf("Excellent"); 13 | else if( (a=='B' || a=='b') ) 14 | printf("Good"); 15 | else if( (a=='C' || a=='c') ) 16 | printf("Satisfactory"); 17 | else if( (a=='D' || a=='d') ) 18 | printf("Needs Improvement"); 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Tutorials/2022 Oct Tutorials/Turorial 05/E04-Shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | int i, j; 5 | // printf first 7 lines 6 | for (i = 0; i <= 7; i++) { 7 | for (j = 1; j <= i; j++) { 8 | printf("*"); 9 | } 10 | printf("\n"); 11 | } 12 | 13 | // print 8 to 11 lines 14 | for (i = 7; i > 0; i -= 2) { 15 | for (j = 1; j <= i; j++) { 16 | printf("*"); 17 | } 18 | printf("\n"); 19 | } 20 | 21 | return 0; 22 | } -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 7/Question3-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | //top 8 | char a[10]="*"; 9 | for(int i=0;i<7;i++){ 10 | printf("%s\n",a); 11 | strcat(a, "*");//concatenating a[] with * 12 | } 13 | 14 | //bottom 15 | int b=7; 16 | for(int i=4;i>0;i--){ 17 | for(int i=b;i>0;i--){ 18 | printf("*"); 19 | } 20 | printf("\n"); 21 | b-=2; 22 | } 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 04/Exercise 1.c: -------------------------------------------------------------------------------- 1 | /*Write a C program to input an integer from the keyboard and convert the number into a positive 2 | number, if the user input is a negative value*/ 3 | 4 | #include 5 | int main(void) 6 | { 7 | int n; 8 | 9 | printf("Enter an integer : "); 10 | scanf("%d",&n);//get input for n 11 | 12 | if (n<0) 13 | 14 | { 15 | n=-n;//calculation 16 | } 17 | 18 | printf("%d",n);//show answer 19 | 20 | return 0; 21 | }// end of main function 22 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 06/EX 1/Exercise 1 Practice to use math library functions 5.c: -------------------------------------------------------------------------------- 1 | /*Exercise 1 Practice to use math library functions 2 | Show the value of x after each of the following statements is performed: 3 | i. x = floor(7.5) 4 | ii. x = ceil (0.0) 5 | iii. x = ceil (-6.4) 6 | iv. x = log10(100.0) 7 | v. x = ceil (floor (-5.5)) */ 8 | 9 | #include 10 | #include 11 | int main(void) 12 | { 13 | printf("%.2f",ceil (floor (-5.5))); 14 | 15 | return 0; 16 | }//end of the main function 17 | -------------------------------------------------------------------------------- /Tutorials/2022 Oct Tutorials/Tutorial 01/Exercise3-i-shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // start the main 4 | int main(void) { 5 | // variable declaration 6 | float celsius, fahrenheit; 7 | 8 | // get celsius value 9 | printf("Enter celsius temparature : "); 10 | scanf("%f", &celsius); 11 | 12 | // calculation 13 | fahrenheit = celsius * (9/5.0) + 32; 14 | 15 | // displaye fahrenheit temp 16 | printf("%.2f C = %.2f F", celsius, fahrenheit); 17 | 18 | return 0; 19 | } // end of main function -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 10/Question3-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | int main() 5 | { 6 | int Motion[5]; 7 | 8 | for(int i=0; i<5; ++i){ 9 | printf("Enter number%d: ",i+1); 10 | scanf("%d", &Motion[i]); 11 | } 12 | 13 | printf("After rotating: "); //doesn't need additional loops if you want to just print 14 | for(int j=0;j<4;j++){ //rotated array. 15 | printf("%d " ,Motion[j+1]); 16 | } 17 | 18 | printf("%d",Motion[0]); 19 | return 0; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 8/Additional Exercises/Question1-i-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void solidSquare(int); 4 | 5 | int main() 6 | { 7 | int side; 8 | 9 | printf("Side Value : "); 10 | scanf("%d", &side); 11 | printf("\n"); 12 | 13 | solidSquare(side); 14 | 15 | return 0; 16 | } 17 | 18 | void solidSquare(int side) { 19 | int count1, count2; 20 | for (count1 = 1; count1 <= side; count1++){ 21 | for (count2 = 1; count2 <= side; count2++){ 22 | printf("*"); 23 | } 24 | printf("\n"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 5/Question3-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int b[9]={0}; 6 | int s=0; 7 | int c; 8 | 9 | while(s!=(-1)){ 10 | printf("Enter Salary: "); 11 | scanf("%d",&s); 12 | 13 | if(s==(-1)) 14 | break; 15 | 16 | if(s>1000) 17 | b[8]+=1; 18 | else{ 19 | c=((s/100)-2); 20 | b[c]+=1; 21 | } 22 | } 23 | 24 | for(int i=0;i<9;i++)//jsut printing the array 25 | printf("%c) %d\n",(97+i),b[i]); 26 | 27 | return 0; 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 11/Question2-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | int main() 5 | { 6 | int a[4][4]={{5,7,8,10},{9,3,0,6},{8,1,9,2},{4,7,2,1}}; 7 | int b[4][4]={{2,2,1,3},{8,1,3,1},{1,2,2,4},{3,1,1,2}}; 8 | int c[4][4]; 9 | 10 | for(int i=0;i<4;i++){ 11 | for(int j=0;j<4;j++){ 12 | c[i][j]=a[i][j]+b[i][j]; 13 | } 14 | } 15 | 16 | for(int k=0;k<4;k++){ 17 | for(int l=0;l<4;l++) 18 | printf("%d ",c[k][l]); 19 | printf("\n"); 20 | } 21 | 22 | return 0; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Other Questions/Question 3/Answers - Randula/Q3 Part 2 - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main () 4 | { 5 | //declaring variables 6 | char name[20]; 7 | int year , age; 8 | 9 | //taking user inputs for name 10 | printf("Name : "); 11 | scanf("%s" , name); 12 | 13 | //taking user inputs for year 14 | printf("Year of Birth : "); 15 | scanf("%d" , &year); 16 | 17 | printf("\n"); 18 | 19 | //calculate the age 20 | age = 2021 - year; 21 | 22 | //print the output 23 | printf("Hey %s!!! You are %d years old. Great" , name , age); 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 8/Question3-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int add(int a,int b);//function initialization 5 | int multiply(int a,int b); 6 | int square(int a); 7 | 8 | int main() 9 | { 10 | int c = multiply(3,4); 11 | int d = multiply(5,7); 12 | int f = add(c,d); 13 | int g = square(f); 14 | 15 | printf("%d", g ); 16 | return 0; 17 | } 18 | 19 | int add(int a,int b){ 20 | return( a+b ); 21 | } 22 | int multiply(int a,int b){ 23 | return( a*b ); 24 | } 25 | int square(int a){ 26 | return( pow(a,2) ); 27 | } 28 | -------------------------------------------------------------------------------- /Tutorials/2022 Oct Tutorials/Turorial 05/E01-iii-Shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | float num = 0; 5 | int count = 0; 6 | float sum = 0; 7 | float avg = 0; 8 | 9 | while(num >= 0) { 10 | printf("Enter Number, Minus to end : "); 11 | scanf("%f", &num); 12 | if (num >= 0) { 13 | sum += num; 14 | count++; 15 | avg = sum / (float)count; 16 | } 17 | } 18 | printf("\nTotal of %.2d numbers %.2f\n", count, sum); 19 | printf("Average of %.2d numbers %.2f\n\n", count, avg); 20 | return 0; 21 | } -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | on: [push, pull_request] 2 | 3 | jobs: 4 | contrib-readme-job: 5 | runs-on: ubuntu-latest 6 | name: A job to automate contrib in readme 7 | steps: 8 | - name: Contribute List 9 | uses: akhilmhdh/contributors-readme-action@v2.2.1 10 | with: 11 | image_size: 100(px) 12 | columns_per_row: 3 13 | committer_username: ThusharaX 14 | commit_message: Contributors list updated 15 | env: 16 | GITHUB_TOKEN: ${{ secrets.CON_TOKEN }} 17 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionB/versionB-a-Thushara.c: -------------------------------------------------------------------------------- 1 | // Online Test2 - Version B - a 2 | 3 | #include 4 | 5 | // main function 6 | int main(void) 7 | { 8 | // variable declaration 9 | int i, j; 10 | int value = 97; // initialize value variable 11 | 12 | // print rows 13 | for (i = 1; i <= 5; i++) { 14 | 15 | // print column 16 | for (j = 5; j >= i; j--) { 17 | 18 | // print character value 19 | printf("%c", value); 20 | } 21 | printf("\n"); 22 | 23 | // increse value by 1 24 | value += 1; 25 | } // end for 26 | 27 | return 0; 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 4/Question2-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | int i; 8 | int j; 9 | int k; 10 | 11 | //1 12 | printf("********\n"); 13 | for(i=0;i<4;i++){ 14 | printf("* *\n"); 15 | }printf("********\n"); 16 | 17 | //2 18 | char a[20] = "*"; 19 | for(j=0;j<6;j++){ 20 | printf("%s\n",a); 21 | strcat(a, "*"); 22 | } 23 | 24 | //3 25 | printf(" *\n ***\n*****\n"); 26 | for(k=3;k>0;k--){ 27 | printf("%3s\n","*"); 28 | } 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 11/Question2-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define SIZE 4 5 | 6 | int main(void) 7 | { 8 | int A[SIZE][SIZE] = { {5,7,8,10}, 9 | {9,3,0,6}, 10 | {8,1,9,2}, 11 | {4,7,2,1} }; 12 | 13 | int B[SIZE][SIZE] = { {2,2,1,3}, 14 | {8,1,3,1}, 15 | {1,2,2,4}, 16 | {3,1,1,2} }; 17 | int C[SIZE][SIZE]; 18 | int a, b; 19 | 20 | for (a = 0; a < SIZE; a++) { 21 | for (b = 0; b < SIZE; b++) { 22 | C[a][b] = A[a][b] + B[a][b]; 23 | printf("%d ", C[a][b]); 24 | } 25 | printf("\n"); 26 | } 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 12/Question1.(c)-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a,b=1; 6 | char c[30]; 7 | while(b==1){ 8 | printf("Enter a number: "); 9 | scanf("%d",&a); 10 | if(a==21||a==43||a==76||a==98||a==40){ 11 | printf("Wrong number\n"); 12 | }else 13 | b=0; 14 | } 15 | 16 | FILE *fptr; 17 | fptr = fopen("number.dat","a+"); 18 | if(fptr==NULL) 19 | { 20 | printf("Error opening file"); 21 | return(-1); 22 | } 23 | 24 | fprintf(fptr," %d",a); 25 | fclose(fptr); 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /Other Questions/Arrays/03/Untitled1.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int myArray[10]; 5 | int i,sum = 0; 6 | float avg; 7 | 8 | for(i=0;i<10;i++) 9 | { 10 | printf("Enter a number :"); 11 | scanf("%d",&myArray[i]); 12 | 13 | sum = sum + myArray[i]; 14 | } 15 | avg = sum/10.0; 16 | 17 | printf("\n\nNumber series :"); 18 | 19 | for(i=0;i<10;i++) 20 | { 21 | printf(" %d ",myArray[i]); 22 | } 23 | 24 | printf("\n\nAverage :%.2f\n",avg); 25 | 26 | printf("\nlarge Number :"); 27 | 28 | for(i=00;i<10;i++) 29 | { 30 | if(myArray[i] > avg) 31 | { 32 | printf(" %d ", myArray[i]); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 10/Additional Exercises/Question1-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // main function 4 | int main() { 5 | 6 | // declaring variables 7 | int numbers[5], count, i, max = 0; 8 | 9 | // input values to numbers array 10 | for (count = 1; count <= 5; count++) { 11 | printf("Enter value : "); 12 | scanf("%d", &numbers[count]); 13 | } 14 | 15 | // finding maximun value of the array 16 | for (i = 1; i < count; i++) { 17 | if (numbers[i] > max) { 18 | max = numbers[i]; 19 | } 20 | } 21 | 22 | // printing maximun value 23 | printf("\nMaximum value : %d", max); 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 06/Exercise 1.c: -------------------------------------------------------------------------------- 1 | /*Exercise 1 Practice to use math library functions 2 | Show the value of x after each of the following statements is performed: 3 | i. x = floor(7.5) 4 | ii. x = ceil (0.0) 5 | iii. x = ceil (-6.4) 6 | iv. x = log10(100.0) 7 | v. x = ceil (floor (-5.5)) */ 8 | 9 | #include 10 | #include 11 | int main(void) 12 | { 13 | printf("%.2f\n",floor(7.5)); //i 14 | printf("%.2f\n",ceil (0.0)); //ii 15 | printf("%.2f\n",ceil (-6.4)); //iii 16 | printf("%.2f\n",log10(100.0)); //iv 17 | printf("%.2f\n",ceil (floor (-5.5))); //v 18 | 19 | return 0; 20 | }//end of the main function 21 | -------------------------------------------------------------------------------- /Tutorials/2022 Oct Tutorials/Tutorial 01/Exercise2-iii-shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // start the main function 4 | int main(void) { 5 | 6 | int mark1, mark2; // for two subjects marks 7 | float avg; // average 8 | 9 | // get first subject mark 10 | printf("Enter subject 1 mark : "); 11 | scanf("%d", &mark1); 12 | // get second subject mark 13 | printf("Enter subject 2 mark : "); 14 | scanf("%d", &mark2); 15 | 16 | // calculate average of marks 17 | avg = (mark1 + mark2) / 2.0; 18 | 19 | // display average 20 | printf("Your average = %.2f", avg); 21 | 22 | return 0; 23 | 24 | } // end of main -------------------------------------------------------------------------------- /Other Questions/Question 3/Answers - Randula/Q3 Part 1 - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main () 5 | { 6 | //declaing variables 7 | char address[200]; 8 | int i , length; 9 | 10 | //taking user inputs 11 | printf("Input : "); 12 | gets(address); 13 | 14 | 15 | //getting the input's charactor length 16 | length = strlen(address); 17 | 18 | //print the output in different lines 19 | printf("Output : "); 20 | for (i = 0 ; i < length ; i++) 21 | { 22 | if (address[i] == ',') 23 | { 24 | printf(",\n\t "); 25 | } 26 | else 27 | { 28 | printf("%c" , address[i]); 29 | } 30 | } 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /Other Questions/Question 12/01.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | 5 | float marks,min,max; 6 | min = 101, max = 0; 7 | 8 | printf("Enter marks :"); 9 | scanf("%f", &marks); 10 | 11 | while(marks != -99) 12 | { 13 | 14 | 15 | if(marks > 100 || marks < 0) 16 | { 17 | printf("Invalid marks Please re enter your marks---\n"); 18 | } 19 | if(marks > max) 20 | { 21 | max = marks; 22 | } 23 | else if(marks < min) 24 | { 25 | min = marks; 26 | } 27 | 28 | printf("Enter marks :"); 29 | scanf("%f", &marks); 30 | } 31 | 32 | printf("\nMax marks :%.2f", max); 33 | printf("\nMin marks :%.2f", min); 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 06/Exercise 2.c: -------------------------------------------------------------------------------- 1 | /*Exercise 2 : Practice to write a simple function 2 | Write a function called circleArea() that take the radius of a circle as an argument and 3 | calculate and return the area. In the main program read the radius value from the user, call 4 | circleArea() and display the result. */ 5 | 6 | #include 7 | float circleArea(float radius); 8 | int main(void) 9 | { 10 | float r; 11 | printf("Enter Radius : "); 12 | scanf("%f",&r);//input radius 13 | printf("Area = %.2f",circleArea(r));//print aria 14 | } 15 | float circleArea(float radius) 16 | { 17 | return (22/7.0)*radius*radius; 18 | }//end of main function 19 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 11/Question1-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) { 5 | 6 | char word[10]; 7 | int length, count, flag; 8 | 9 | printf("Enter any word : "); 10 | scanf("%10s", word); 11 | 12 | length = strlen(word); 13 | 14 | for (count = 0; count <= (length/2); count++) { 15 | if (word[count] != word[(length - 1) - count]) { 16 | flag = 0; 17 | break; 18 | } 19 | 20 | else { 21 | flag = 1; 22 | } 23 | } 24 | 25 | if (flag == 1) { 26 | printf("\n%s is a palindrome\n", word); 27 | } 28 | else { 29 | printf("\n%s is a not a palindrome\n", word); 30 | } 31 | 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.py 2 | 3 | # Prerequisites 4 | *.d 5 | 6 | # Object files 7 | *.o 8 | *.ko 9 | *.obj 10 | *.elf 11 | 12 | # Linker output 13 | *.ilk 14 | *.map 15 | *.exp 16 | 17 | # Precompiled Headers 18 | *.gch 19 | *.pch 20 | 21 | # Libraries 22 | *.lib 23 | *.a 24 | *.la 25 | *.lo 26 | 27 | # Shared objects (inc. Windows DLLs) 28 | *.dll 29 | *.so 30 | *.so.* 31 | *.dylib 32 | 33 | # Executables 34 | *.exe 35 | *.out 36 | *.app 37 | *.i*86 38 | *.x86_64 39 | *.hex 40 | 41 | # Debug files 42 | *.dSYM/ 43 | *.su 44 | *.idb 45 | *.pdb 46 | 47 | # Kernel Module Compile Results 48 | *.mod* 49 | *.cmd 50 | .tmp_versions/ 51 | modules.order 52 | Module.symvers 53 | Mkfile.old 54 | dkms.conf -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 11/Additional Exercises/Question1(a,b)-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | char stAnswer[3][5]={'0'}; 6 | char a; 7 | 8 | for(int i=0;i<3;i++){ 9 | printf("Student %d:\n",i+1); 10 | 11 | for(int j=0;j<5;j++){ 12 | printf("Answer for question %d: ",j+1); 13 | scanf(" %c",&a); 14 | 15 | if(a=='t' || a=='T' || a=='f' || a=='F') 16 | a=stAnswer[i][j]; 17 | else{ 18 | printf("re-enter the value\n"); 19 | j-=1; 20 | } 21 | } 22 | printf("\n"); 23 | } 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 12/Question2.(c)-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int c=0,s=0,t=0; 6 | char d; 7 | char n[20]; 8 | FILE *fptr; 9 | fptr = fopen("appointment.dat","r"); 10 | 11 | printf("Appointment Type\tNumber of Patients\n"); 12 | for(int i=0;i<5;i++){ 13 | fscanf(fptr,"%s %c\n",&n,&d); 14 | if(d=='C') 15 | c++; 16 | else if(d=='S') 17 | s++; 18 | else if(d=='T') 19 | t++; 20 | } 21 | 22 | printf("Consulting\t%d\n",c); 23 | printf("Scanning\t%d\n",s); 24 | printf("Testing\t%d\n",t); 25 | 26 | fclose(fptr); 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 6/Question5-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | char a; 8 | printf("Enter Grade: "); 9 | scanf(" %c",&a); 10 | 11 | switch(a){ 12 | 13 | case 'A': 14 | case 'a': 15 | printf("Excellent"); 16 | break; 17 | 18 | case 'B': 19 | case 'b': 20 | printf("Good"); 21 | break; 22 | 23 | case 'C': 24 | case 'c': 25 | printf("Satisfactory"); 26 | break; 27 | 28 | case 'D': 29 | case 'd': 30 | printf("Needs Improvement"); 31 | break; 32 | } 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 09/Exercise 1.c: -------------------------------------------------------------------------------- 1 | //Exercise 1 : Practice to manipulate character array 2 | 3 | #include 4 | #include 5 | #define size 20 6 | int main( void ) 7 | {//function main begins 8 | int i, len;//declaring variables 9 | char fdarray[size], bkarray[size]; 10 | 11 | printf( "Input Word : " );//prompt 12 | scanf( "%20s", fdarray );//get inputs 13 | 14 | len = strlen(fdarray);//find length 15 | 16 | for( i =0; i < (len/2) ; ++i ){ 17 | 18 | if( fdarray[i] != fdarray[len -1]){ 19 | 20 | printf( "\nIt is Not a Palindrome\n" ); 21 | return -1; 22 | } 23 | } 24 | printf( "\nIt is a Palindrome\n"); 25 | 26 | }//function main ends 27 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 8/Additional Exercises/Question1-ii-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void solidSquare(int, char); 4 | 5 | int main() 6 | { 7 | int side = 0, count1, count2; 8 | char fillCharacter; 9 | 10 | printf("Side Value : "); 11 | scanf("%d", &side); 12 | printf("Fill Character : "); 13 | scanf(" %c", &fillCharacter); 14 | printf("\n"); 15 | 16 | solidSquare(side, fillCharacter); 17 | 18 | return 0; 19 | } 20 | 21 | void solidSquare(int side, char fillCharacter) { 22 | int count1, count2; 23 | for (count1 = 1; count1 <= side; count1++){ 24 | for (count2 = 1; count2 <= side; count2++){ 25 | printf("%c", fillCharacter); 26 | } 27 | printf("\n"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Tutorials/2022 Oct Tutorials/Tutorial 01/Exercise3-ii-shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // start the main 4 | int main(void) { 5 | float fare1, fare2, fare3, totalFare; // variable declaration 6 | 7 | // get fares and assign to variables 8 | printf("Enter your first bus fare : "); 9 | scanf("%f", &fare1); 10 | printf("Enter your second bus fare : "); 11 | scanf("%f", &fare2); 12 | printf("Enter your third bus fare : "); 13 | scanf("%f", &fare3); 14 | 15 | // calcualte total fare 16 | totalFare = (fare1 + fare2 + fare3) * 2 * 5 * 14.0; 17 | 18 | // displaye total fare 19 | printf("Total expenditure = %.2f", totalFare); 20 | 21 | return 0; 22 | } // end of main -------------------------------------------------------------------------------- /Lab Sheets/2020 Lab Sheets/Lab Sheet 7/Question 2-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int y; 6 | char name[20],clas; 7 | int year; 8 | float GPA; 9 | int c=1; 10 | 11 | FILE *fptr; 12 | fptr = fopen("Student.dat","r"); 13 | 14 | printf("Enter Year: "); 15 | scanf("%d",&y); 16 | 17 | //ignore the first line 18 | fscanf(fptr,"%s %s %s %s", &name, &clas, &year, &GPA); 19 | 20 | while(!feof(fptr)){ 21 | fscanf(fptr,"%s %c %d %f", &name, &clas, &year, &GPA); 22 | 23 | if(year==y){ 24 | printf("Name: %s GPA: %.1f",name,GPA); 25 | break; 26 | } 27 | } 28 | 29 | fclose(fptr); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 05/Exercise 1 B.c: -------------------------------------------------------------------------------- 1 | //Prompt the user to enter series of numbers from the keyboard and display the numbers. If user enters a negative number stop reading the numbers. 2 | 3 | #include 4 | int main(void) 5 | { 6 | int no; 7 | 8 | printf("Input Numbers\n\n"); 9 | 10 | printf("Input Number : "); 11 | scanf("%d",&no);//get no 12 | 13 | while (no>=0){//repetition condition 14 | printf("Output %d\n\n",no);//show no 15 | 16 | printf("Input Number : "); 17 | scanf("%d",&no);//get no 18 | 19 | }//end of the while function 20 | 21 | printf("\n"); 22 | printf("End Of Reading...."); 23 | 24 | return 0; 25 | 26 | }//end of main function 27 | -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 5/Version 4 - (Rainfall)/Version4(Rainfall) - Sahan.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i, j; 6 | float rainfall[3][4], maxRainfall[4]; 7 | 8 | for (i = 0; i < 3; ++i) 9 | { 10 | maxRainfall[i] = 0; 11 | 12 | for (j = 0; j < 4; ++j){ 13 | rainfall[i][j] = 0; 14 | 15 | printf("Input the rainfall for day %d in city %d: ", i+1, j+1); 16 | scanf("%f", &rainfall[i][j]); 17 | 18 | if (rainfall[i][j] > maxRainfall[i]) 19 | maxRainfall[i] = rainfall[i][j]; 20 | } 21 | printf("\n"); 22 | } 23 | 24 | for (i = 0; i < 3; ++i) 25 | { 26 | printf("\nMaximum rainfall for day %d: %.2f", i+1, maxRainfall[i]); 27 | } 28 | 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 05/Exercise 4.c: -------------------------------------------------------------------------------- 1 | //Exercise 4: Practice to write nested loops 2 | 3 | #include 4 | int main( void ) 5 | {// function main begins 6 | int i,counter; 7 | 8 | for( i = 1; i <= 7 ; i++){ //1st for loop begins 9 | 10 | for( counter = 1; counter <= i ; counter++){ //2nd for loop begins 11 | printf( "*"); 12 | } //2nd for loop end 13 | printf( "\n"); 14 | 15 | } //1st for loop ends 16 | 17 | for( i = 7; i >=1 ; i-=2){ //3rd for loop begins 18 | 19 | for( counter = 1; counter <= i ; counter++ ){ //4th for loop begins 20 | printf( "*"); 21 | } //4th for loop ends 22 | printf("\n"); 23 | } //3rd for loop ends 24 | 25 | return 0; 26 | } //end of the main function 27 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionE/Version E - Randula/Q2 - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float findRadianValue(float angleInDegrees); 4 | void printRadianValues(void); 5 | 6 | int main (void) 7 | { 8 | printRadianValues(); 9 | return 0; 10 | } 11 | 12 | float findRadianValue(float angleInDegrees) 13 | { 14 | float angleInradian; 15 | 16 | angleInradian = angleInDegrees / 180 * 22.0 / 7; 17 | 18 | return angleInradian; 19 | } 20 | void printRadianValues(void) 21 | { 22 | int i; 23 | float radian; 24 | 25 | printf("Angle(degree)\tAngle(radians)\n"); 26 | 27 | for (i = 100 ; i <= 200 ; i += 20) 28 | { 29 | radian = findRadianValue(i); 30 | printf("%d%17.2f\n" , i , radian); 31 | } 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 3/VersionE/Version E - Randula (Ascending).c: -------------------------------------------------------------------------------- 1 | //ascending check 2 | 3 | #include 4 | 5 | int main (void) 6 | { 7 | //declaring array 8 | int input[6]; 9 | 10 | //declaring variavle 11 | int i; 12 | 13 | //taking inputs from the user 14 | for(i = 0 ; i < 6 ; i++) 15 | { 16 | printf("Enter a Number : "); 17 | scanf("%d" , &input[i]); 18 | } 19 | 20 | //check if the input sequence in ascending 21 | for(i = 1 ; i < 6 ; i++) 22 | { 23 | if (input[i] < input[i - 1]) 24 | { 25 | printf("Numbers are not stored in ascending order.\n"); 26 | return -1; 27 | } 28 | } 29 | 30 | printf("Numbers are stored in ascending order.\n"); 31 | return 0; 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /Past Papers/2021 May/Online Test 1/Version 3 (bank)/Version 3 - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | //declare variables 6 | int age; 7 | float balance; 8 | 9 | //take user inputs 10 | printf("Age : "); 11 | scanf("%d" , &age); 12 | 13 | printf("Bank Balance : "); 14 | scanf("%f" , &balance); 15 | 16 | //display the gift 17 | printf("Gift : "); 18 | if (age > 18) 19 | { 20 | if (balance > 100000) 21 | { 22 | printf("Rice Cooker\n"); 23 | } 24 | else 25 | { 26 | printf("Travelling Bag\n"); 27 | } 28 | } 29 | else 30 | { 31 | if (balance > 100000) 32 | { 33 | printf("Tablet\n"); 34 | } 35 | else 36 | { 37 | printf("School Bag\n"); 38 | } 39 | } 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 10/Question1-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | int main() 5 | { 6 | int marks[10], n=10, sum = 0, mean; 7 | int a; 8 | 9 | for(int i=0; i0){ 13 | marks[i]=a; 14 | } 15 | } 16 | 17 | for(int j=0;jmean){ 29 | printf("indexes of the students with more than the mean: %d\n", k);} 30 | } 31 | 32 | 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /Lab Sheets/2021 Feb Lab Sheets/Lab Sheet 11/Lab sheet 11 - Randula/Excercise 4 - Randula.c: -------------------------------------------------------------------------------- 1 | //importing libraries 2 | #include 3 | #include 4 | 5 | int main (void) 6 | { 7 | char input[20]; 8 | int i , length; 9 | 10 | printf("Enter a Name : "); //prompt 11 | scanf("%s" , input); //assign the type string to the variable 12 | 13 | 14 | length = strlen(input); //get the charator amount of the user entered string 15 | 16 | //check whether the length in less than 20 or not 17 | if (length > 20) 18 | { 19 | printf("Error!!\n"); 20 | } 21 | else 22 | { 23 | //printng the string backwords 24 | for (i = 0 ; i <= length ; i++) 25 | { 26 | printf("%c" , input[length - i]); 27 | } 28 | } 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 3/VersionE/Version E - Randula (Deascending).c: -------------------------------------------------------------------------------- 1 | //deascending check 2 | 3 | #include 4 | 5 | int main (void) 6 | { 7 | //declaring array 8 | int input[6]; 9 | 10 | //declaring variavle 11 | int i; 12 | 13 | //taking inputs from the user 14 | for(i = 0 ; i < 6 ; i++) 15 | { 16 | printf("Enter a Number : "); 17 | scanf("%d" , &input[i]); 18 | } 19 | 20 | //check if the input sequence in ascending 21 | for(i = 1 ; i < 6 ; i++) 22 | { 23 | if (input[i] > input[i - 1]) 24 | { 25 | printf("Numbers are not stored in deascending order.\n"); 26 | return -1; 27 | } 28 | } 29 | 30 | printf("Numbers are stored in deascending order.\n"); 31 | return 0; 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 11/Question3-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a[4][5]={0}; 6 | int s,p,d; 7 | int b=1; 8 | int i; 9 | int j; 10 | 11 | while(b==1){ 12 | printf("sales person number: "); 13 | scanf("%d",&s); 14 | printf("product number: "); 15 | scanf("%d",&p); 16 | printf("total dollar value: "); 17 | scanf("%d",&d); 18 | a[s-1][p-1]=d; 19 | 20 | printf("If you want to enter more, enter 1, else 0: "); 21 | scanf("%d",&b); 22 | printf("\n"); 23 | } 24 | 25 | for(i=0;i<4;i++){ 26 | for(j=0;j<5;j++) 27 | printf("%d person's %d product sales %d$\n",(i+1),(j+1),a[i][j]); 28 | printf("\n"); 29 | } 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /Tutorials/2022 Oct Tutorials/Turorial 05/E02-Shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | int x = 10; 5 | 6 | printf("\n\nDo While Loop x = 10\n"); 7 | do { 8 | printf("%d\t", x); 9 | x--; 10 | } while (x > 1); 11 | 12 | x = 10; 13 | printf("\n\nWhile Loop x = 10\n"); 14 | while (x > 1) { 15 | printf("%d\t", x); 16 | x--; 17 | } 18 | 19 | x = 1; 20 | printf("\n\nDo While Loop x = 1\n"); 21 | do { 22 | printf("%d\t", x); 23 | x--; 24 | } while (x > 1); 25 | 26 | x = 1; 27 | printf("\n\nWhile Loop x = 1\n"); 28 | while (x > 1) { 29 | printf("%d\t", x); 30 | x--; 31 | } // check this point carefully. do vs while 32 | 33 | return 0; 34 | } -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 8/Additional Exercises/Question2-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void roots(float a,float b,float c);//i)function initialization 5 | 6 | int main() 7 | { 8 | float a; 9 | float b; 10 | float c; 11 | 12 | printf("Enter a: "); 13 | scanf("%f",&a); 14 | printf("Enter b: "); 15 | scanf("%f",&b); 16 | printf("Enter c: "); 17 | scanf("%f",&c); 18 | 19 | roots(a,b,c); 20 | 21 | return 0; 22 | } 23 | 24 | void roots(float a,float b,float c){ 25 | 26 | float d = sqrt( (pow(b,2)-(4*a*c)) ); 27 | //root 1 28 | float r1 = ((-b)+d)/(2*a); 29 | //root 2 30 | float r2 = ((-b)-d)/(2*a); 31 | 32 | printf("Roots are: %.2f, %.2f",r1,r2); 33 | 34 | } 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 08/Exercise 1 B.c: -------------------------------------------------------------------------------- 1 | /*Exercise 1: Practice to store and print data in an array 2 | ex b */ 3 | 4 | #include 5 | int main( void ) 6 | {//function main begins 7 | int counter; 8 | float marks[10], check_marks; 9 | 10 | 11 | for( counter = 0 ; counter < 10 ; ++counter ){ 12 | 13 | printf( "Input Mark %d : ", counter );//prompt 14 | scanf("%f", &check_marks);//read marks from user 15 | 16 | if( check_marks >= 0 && check_marks <=20 ){// checking condition 17 | 18 | marks[counter] = check_marks; 19 | 20 | } 21 | 22 | else { 23 | 24 | printf( "\n:: Invalid marks :: \n");//prompt 25 | counter = counter - 1 ; // get counter to back 26 | 27 | } 28 | 29 | } 30 | 31 | return 0; 32 | }// end of the main function 33 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionE/Version E - Randula/Q1 - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | int input = 0, minMarks , maxMarks; 6 | 7 | minMarks = 100; 8 | maxMarks = -100; 9 | 10 | printf("Enter the Marks : "); 11 | scanf("%d" , &input); 12 | 13 | while(input != -99) 14 | { 15 | if(input > 100 || input < 0) 16 | { 17 | printf("Invalid Input!!"); 18 | } 19 | else 20 | { 21 | if (input >= maxMarks) 22 | { 23 | maxMarks = input; 24 | } 25 | else if (input < minMarks) 26 | { 27 | minMarks = input; 28 | } 29 | } 30 | printf("Enter the Marks : "); 31 | scanf("%d" , &input); 32 | } 33 | 34 | printf("Maximum Marks : %d\n" , maxMarks); 35 | printf("Minimum Marks : %d\n" , minMarks); 36 | 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /Lab Sheets/2021 Feb Lab Sheets/Lab Sheet 11/Lab Sheet 11 - Léo/Exercise 5 - Léo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void convertToUpperCase( char a[], int size); 5 | 6 | int main() 7 | { 8 | char address[150]; 9 | char string[] = "SLIIT,New Kandy Road, Malabe"; 10 | int len; 11 | 12 | 13 | 14 | strcpy( address, string); 15 | len = strlen(address); 16 | 17 | convertToUpperCase( address, len); 18 | 19 | return 0; 20 | } 21 | 22 | void convertToUpperCase( char a[], int size) 23 | { 24 | int i; 25 | 26 | for( i = 0 ; i < size ; i++){ 27 | 28 | if( a[i] >= 97 && a[i] <= 122){ 29 | a[i] -=32; 30 | printf( "%c", a[i] ); 31 | } 32 | else if( a[i] >= 65 && a[i] <= 122 ){ 33 | printf( "%c", a[i]); 34 | } 35 | else{ 36 | printf("%c",a[i]); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 10/Additional Exercises/Question2-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // function prototype 4 | void printGraph(int); 5 | 6 | // main function 7 | int main() 8 | { 9 | // declaring variables 10 | int count, numbers[10] = {19, 3, 15, 7, 11, 9, 13, 5, 17, 1}; 11 | 12 | // printing header 13 | printf("Element\tValue\tHistogram\n"); 14 | 15 | // printing Element & Value 16 | for (count = 0; count < 10; count++) { 17 | printf("%d\t%d\t", count, numbers[count]); 18 | 19 | // function call for print graph 20 | printGraph(numbers[count]); 21 | printf("\n"); 22 | } 23 | 24 | return 0; 25 | } 26 | 27 | // function definition 28 | void printGraph(int value) { 29 | int i; 30 | for (i = 1; i <= value; i ++) { 31 | printf("*"); 32 | } 33 | } 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 7/Question2-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | char n[10]; 8 | int m; 9 | char nn[10]; 10 | int mm=0; 11 | int i; 12 | int j; 13 | 14 | for(i=0;i<3;i++){ 15 | printf("Enter name: "); 16 | scanf(" %s",&n); 17 | int t = 0; 18 | 19 | for(j=0;j<4;j++){ 20 | 21 | printf("Enter Mark: "); 22 | scanf(" %d",&m); 23 | t+=m; 24 | } 25 | 26 | printf("Total marks: %d\n",t); 27 | 28 | if(mm 5 | int main( void ) 6 | {//function main begins 7 | int no[10], counter, i; 8 | 9 | for( counter = 0 ; counter < 10 ; ++counter ){ 10 | 11 | printf( "Input Element %d for array : ", counter ); 12 | scanf( "%d", &no[counter]); 13 | 14 | } 15 | 16 | printf( "Element\tValue\tHistogram\n" ); 17 | 18 | for( counter=0 ; counter < 10 ; ++counter ){ 19 | 20 | printf( "%d\t%d\t ", counter, no[counter] ); 21 | 22 | for( i = 1; i <= no[counter] ; ++i ){ 23 | 24 | printf( "*" ); 25 | } 26 | printf( "\n" ); 27 | 28 | } 29 | 30 | return 0; 31 | }//function main ends 32 | -------------------------------------------------------------------------------- /Lab Sheets/2021 Feb Lab Sheets/Lab Sheet 11/Lab sheet 11 - Randula/Excercise 1 - Randula.c: -------------------------------------------------------------------------------- 1 | //importing libraries 2 | #include 3 | 4 | int main(void) 5 | { 6 | //declare variables 7 | int input = -1 , answer = 1; 8 | int reduce = 0 , count; 9 | 10 | //entering the loop 11 | while(1) 12 | { 13 | //taking user inputs 14 | printf("Enter a Positive Number : "); 15 | scanf("%d" , &input); 16 | 17 | if (input >= 0) 18 | { 19 | while (reduce < input) 20 | { 21 | answer *= (input - reduce); //do the calculation 22 | reduce++; 23 | } 24 | printf("The Factorial of %d is : %d\n" , input , answer); 25 | break; 26 | } 27 | else 28 | { 29 | printf("You have entered a Negative Number!!\n"); //get another chance if user enters a negative number 30 | } 31 | } 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 5/Version 5 - (temperature)/V5-(temperature) - Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) { 4 | 5 | float temp[2][3]; 6 | float avgTemp[2]; 7 | int i = 0, j = 0; 8 | float t = 0, avg = 0; 9 | 10 | for(i = 0; i < 2; i++) { 11 | printf("City %d\n", i+1); 12 | for(j = 0; j < 3; j++) { 13 | printf("\tTemperature : "); 14 | scanf("%f", &temp[i][j]); 15 | } 16 | } 17 | 18 | for(i = 0; i < 2; i++) { 19 | for(j = 0; j < 3; j++) { 20 | t += temp[i][j]; 21 | } 22 | avg = t / 3; 23 | avgTemp[i] = avg; 24 | t = 0; 25 | } 26 | 27 | for(i = 0; i < 2; i ++) { 28 | printf("\nCity %d average temperature = %.2f\n", i+1, avgTemp[i]); 29 | } 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /Tutorials/2022 Oct Tutorials/Tutorial 01/Exercise2-i-ii-shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // start of the main function 4 | int main(void) { 5 | // declaration variables 6 | int length, width, perimeter, area; 7 | 8 | printf("Hello World\n"); // print somthing something 9 | 10 | printf("Enter width of rectangle : "); //display message 11 | scanf("%d", &width); // scan and initialization to width 12 | 13 | printf("Enter length of rectangle : "); // display message 14 | scanf("%d", &length); // scan and initialization to length 15 | 16 | // calculation 17 | area = width * length; 18 | perimeter = (width + length) * 2; 19 | 20 | printf("Perimeter of the rectangle = %d\n", perimeter); // display perimeter 21 | printf("Area of the rectangle = %d", area); // display area 22 | 23 | return 0; 24 | } // end of main -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 10/Question1-full-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // main function 4 | int main() 5 | { 6 | // declaring variables 7 | int count, marks, marksList[10], total = 0; 8 | float mean; 9 | 10 | // adding marks to the array 11 | for (count = 1; count <= 10;) { 12 | printf("Enter Marks : "); 13 | scanf("%d", &marks); 14 | 15 | // check if marks between 0 to 20 16 | if (marks > 0 && marks < 20) { 17 | marksList[count] = marks; 18 | count++; 19 | } 20 | } 21 | 22 | // finding total of the marksList array 23 | for (count = 1; count <= 10; count++) { 24 | total += marksList[count]; 25 | } 26 | 27 | // finding mean of the marks 28 | mean = (float)total / 10; 29 | 30 | // printing mean of the marks 31 | printf("\nMean of the marks : %.2f ", mean); 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 09/Exercise 2.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main( void ) 3 | {//function main begins 4 | int Mat1[4][4], Mat2[4][4], Sum[4][4], i, j;//declaring variables 5 | 6 | printf("\nInput values for Matrix 1 : \n"); 7 | 8 | for(i=0;i<4;i++){//matrix 1 9 | for(j=0;j<4;j++){ 10 | scanf("%d", &Mat1[i][j]); 11 | } 12 | } 13 | 14 | printf("\nInput values for Matrix 2 : \n"); 15 | 16 | for(i=0;i<4;i++){//matrix 2 17 | for(j=0;j<4;j++){ 18 | scanf("%d", &Mat2[i][j]); 19 | } 20 | } 21 | 22 | for(i=0;i<4;i++){//calculation 23 | for(j=0;j<4;j++){ 24 | Sum[i][j] = Mat1[i][j] + Mat2[i][j]; 25 | } 26 | } 27 | 28 | printf("\n:: Sum of the matrix ::\n"); 29 | 30 | for(i=0;i<4;i++){ 31 | for(j=0;j<4;j++){ 32 | printf("%d",Sum[i][j]); 33 | } 34 | printf("\n"); 35 | } 36 | 37 | }//function main ends 38 | -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/Answers - Sahan/1AJune4a - Sahan.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i, j; 5 | char empNumber[3]; 6 | char name[8]; 7 | int attendance; 8 | 9 | FILE * cfPtr; 10 | cfPtr = fopen("attendance.dat", "w"); 11 | 12 | if(cfPtr == NULL) { 13 | printf("File cannot be create"); 14 | return -1; 15 | } 16 | 17 | for(i = 1; i <= 2; ++i) { 18 | printf("Enter Employee Number: "); 19 | scanf("%s", empNumber); 20 | printf("Enter Employee Name: "); 21 | scanf("%s", name); 22 | 23 | fprintf(cfPtr,"%s\t%s\t", empNumber, name); 24 | 25 | for(j = 1; j <= 7; ++j) { 26 | printf("Attendance Status for day %d(0/1): ", j); 27 | scanf("%d", &attendance); 28 | 29 | fprintf(cfPtr,"%d", attendance); 30 | } 31 | printf("\n"); 32 | fprintf(cfPtr,"\n"); 33 | } 34 | fclose(cfPtr); 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /Other Questions/Question 12/02.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float findradianvalue(float angleindegrees); 5 | void printradianvalues(float angleindegrees, float radians); 6 | 7 | int main() 8 | { 9 | float angleindegrees, radians; 10 | 11 | printf("Angles(Degrees)\tAngles(Radians)\n"); 12 | radians = findradianvalue(angleindegrees); 13 | printradianvalues( angleindegrees, radians); 14 | return 0; 15 | } 16 | 17 | float findradianvalue(float angleindegrees) 18 | { 19 | float radians; 20 | radians = 22/(7.0 * 180.0 ) * angleindegrees; 21 | return radians; 22 | } 23 | 24 | void printradianvalues(float angleindegrees, float radians) 25 | { 26 | int i; 27 | 28 | angleindegrees = 100; 29 | for(i=1;i<=6;i++) 30 | { 31 | printf("%.0f\t\t%.2f\n\n",angleindegrees,radians); 32 | angleindegrees = angleindegrees + 20; 33 | 34 | } 35 | return ; 36 | } 37 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 8/Additional Exercises/Question1-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void ab(int a);//i)function initialization 5 | void abc(int c,char d);//ii) 6 | 7 | int main() 8 | { 9 | //i) 10 | int a=4; 11 | ab(a);//calling ab function 12 | 13 | printf("\n"); 14 | 15 | //ii) 16 | int c=4; 17 | char fillCharacter = '#'; 18 | abc(c,fillCharacter);//calling abc function 19 | 20 | return 0; 21 | } 22 | 23 | void ab(int a){ 24 | int x=a; 25 | for(a;a>0;a--){ 26 | for(int b=x;b>0;b--){ 27 | printf("*"); 28 | } 29 | printf("\n"); 30 | } 31 | } 32 | 33 | void abc(int c,char d){ 34 | int y=c; 35 | for(c;c>0;c--){ 36 | for(int f=y;f>0;f--){ 37 | printf("%c",d); 38 | } 39 | printf("\n"); 40 | } 41 | } 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Other Questions/Arrays/04/Untitled1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int numArray[8]; 6 | int i,j; 7 | j = 0; 8 | 9 | for(i=0;i<8;i++) 10 | { 11 | printf("Enter a number :"); 12 | scanf("%d", &numArray[i]); 13 | 14 | if(numArray[i] >4 || numArray[i] < 1) 15 | { 16 | printf("Enter a valid number :"); 17 | scanf("%d", &numArray[i]); 18 | 19 | while(numArray[i] >4 && numArray[i] < 1) 20 | { 21 | i = i-1; 22 | printf("Enter a valid number :"); 23 | scanf("%d", &numArray[i]); 24 | 25 | } 26 | } 27 | } 28 | 29 | printf("\nNum Array :"); 30 | 31 | for(i=0;i<8;i++) 32 | { 33 | printf(" %d ", numArray[i]); 34 | } 35 | 36 | 37 | 38 | for(i=0;i<8;i++) 39 | { 40 | if(numArray[i] == 1 && numArray[i+1] == 3) 41 | { 42 | j = j + 1; 43 | } 44 | } 45 | printf("\nNumber of times the pattern '1 3' appear : %d",j); 46 | } 47 | -------------------------------------------------------------------------------- /Other Questions/Question 6/answer-shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // function declaration 4 | float findRadianValue(float angleInDegrees); 5 | void printdRadianValues(void); 6 | 7 | // start the main 8 | int main(void) { 9 | // local variable declaration 10 | float degrees, radians; 11 | 12 | printf("Angle (degrees)\t\tAngle(radian)\n"); 13 | 14 | radians = findRadianValue(degrees); 15 | printdRadianValues(); 16 | 17 | return 0; 18 | } // end of main 19 | 20 | // function implementation 21 | float findRadianValue(float angleInDegrees) { 22 | float radian; 23 | 24 | radian = (22.0 / 7) / 180 * angleInDegrees; 25 | 26 | return radian; 27 | } 28 | 29 | void printdRadianValues(void) { 30 | float degrees, i; 31 | for (i = 100; i <= 200; i += 20) { 32 | degrees = i; 33 | printf("%.2f\t%.3f\n", degrees, findRadianValue(degrees)); 34 | } 35 | } -------------------------------------------------------------------------------- /Past Papers/2020/June/Online Exam 3/VersionD/2020 June Online 3 Version D - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | double sales[5]; 6 | 7 | //declare variable 8 | int i; 9 | double input; 10 | 11 | //taking user inputs for 5 employees 12 | for (i = 0 ; i < 5 ; i++) 13 | { 14 | printf("Input the sales of Salesmen No.%d : " , i + 1); 15 | scanf("%lf" , &input); 16 | 17 | //only take inputs > 0 18 | if (input < 0) 19 | { 20 | printf("Please re-enter the amount!!\n"); 21 | i--; 22 | } 23 | else 24 | { 25 | sales[i] = input; 26 | } 27 | } 28 | printf("\n"); 29 | 30 | //display details of employees who have satisfied the criteria 31 | printf("Sales Person Number\tSales Amount\n"); 32 | for (i = 0 ; i < 5 ; i++) 33 | { 34 | if (sales[i] > 20000) 35 | { 36 | printf("%d\t\t\t%.2lf\n" , i + 1 , sales[i]); 37 | } 38 | } 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 05/Exercise 3 A.c: -------------------------------------------------------------------------------- 1 | /* Exercise 3: Practice to use loops (Use while loop) 2 | i) Write a C program to enter 4 module marks of a student from the keyboard and 3 | display the total of all four module marks. */ 4 | 5 | #include 6 | int main( void ) 7 | {// function main begins program execution 8 | int marks,total=0,counter = 1; 9 | 10 | printf( "INPUT YOUR 4 MODULE MARKS AND THIS WILL GIVE YOU TOTAL OF ALL MODULE MARK\n" ); 11 | printf( "\n" ); // prompt 12 | 13 | while( counter <= 4 ){ // loop 4 times 14 | printf( "Input Module %d Marks : ",counter ); 15 | scanf( "%d",&marks ); // read marks from user 16 | 17 | total = total + marks; // calculate total 18 | counter++; // increment counter 19 | } // end of while 20 | 21 | printf( "\nTOTAL OF 4 MODULE MARKS : %d \n",total ); // show total 22 | 23 | return 0; 24 | } // end of the mein function 25 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 9/Question1-Thushara.c: -------------------------------------------------------------------------------- 1 | #include // including header files 2 | #include 3 | #include 4 | 5 | // function prototype 6 | double hypotenuse(double side1, double side2); 7 | 8 | // main function 9 | int main() { 10 | 11 | // assert 12 | assert(hypotenuse(3.0, 4.0) == 5.0); 13 | assert(hypotenuse(5.0, 12.0) == 13.0); 14 | assert(hypotenuse(8.0, 15.0) == 17.0); 15 | 16 | // print hypotenuse 17 | printf("Triangle 1 Hypotenuse : %f\n", hypotenuse(3.0, 4.0)); 18 | printf("Triangle 2 Hypotenuse : %f\n", hypotenuse(5.0, 12.0)); 19 | printf("Triangle 3 Hypotenuse : %f\n", hypotenuse(8.0, 15.0)); 20 | 21 | return 0; 22 | } 23 | 24 | // function definition 25 | double hypotenuse(double side1, double side2) { 26 | double hypotenuse; 27 | 28 | hypotenuse = sqrt((side1 * side1) + (side2 * side2)); 29 | 30 | return hypotenuse; // return statement 31 | } 32 | -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/Answers - Sahan/1AJune4b - Sahan.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int count, i; 5 | int empNumberInput; 6 | int empNumber; 7 | char name[10]; 8 | char attendace[7]; 9 | 10 | count=0; 11 | 12 | FILE * cfPtr; 13 | cfPtr = fopen("attendance.dat", "r"); 14 | 15 | if(cfPtr == NULL) { 16 | printf("File cannot be open"); 17 | return -1; 18 | } 19 | 20 | printf("Enter Employee Number: "); 21 | scanf("%d", &empNumberInput); 22 | 23 | fscanf(cfPtr,"%d%s%s", &empNumber, name, attendace); 24 | 25 | while(!feof(cfPtr)) { 26 | 27 | if(empNumber == empNumberInput) { 28 | break; 29 | } 30 | 31 | fscanf(cfPtr,"%d%s%s", &empNumber, name, attendace); 32 | } 33 | 34 | for (i = 0; i < 7; ++i) { 35 | 36 | if (attendace[i] == '1') 37 | ++count; 38 | } 39 | printf("Number of days reported to work: %d", count); 40 | fclose(cfPtr); 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /C-Assessments/Exercise 1/readme.md: -------------------------------------------------------------------------------- 1 | 2 | ## Question 3 | 4 | You are asked to write a C program to calculate the increment given for employees. 5 | 6 | Write a function called calcIncrement() to calculate and return the increment given for employees. The incrementamount is 10% of the salary. Increment is given only to the employees who worked more than 2 years. Function protype is given below. 7 | 8 | float calcIcrement(float salary, int noofYearsWorked); 9 | 10 | Write a function called calcTotalSalary() to calculate the total salary. 11 | (total salary = salary + increment). 12 | 13 | float calcTotalSalary(float salary, float increment); 14 | 15 | In your main function, enter the salary of an employee and the number of years worked from the keyboard. Display the increment and total salary as follows using the functions created. 16 | 17 | ``` 18 | Enter salary : 19 | Enter number of years worked : 20 | Increment : 21 | Total salary : 22 | ``` -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/1AQ2b-Thushara.c: -------------------------------------------------------------------------------- 1 | /* Final Paper 2018 2 | * Question 2 Part B 3 | */ 4 | 5 | // including header files 6 | #include 7 | 8 | #define SIZE 4 9 | 10 | // main function 11 | int main(void) { 12 | 13 | char bulbs[SIZE][SIZE]; 14 | int q, r; 15 | 16 | // input bulb 17 | for (r = 0; r < SIZE; r++) { 18 | for (q = 0; q < SIZE; q++) { 19 | scanf(" %c", &bulbs[r][q]); 20 | } 21 | } 22 | 23 | // print bulb array 24 | printf("\n"); 25 | for (r = 0; r < SIZE; r++) { 26 | for (q = 0; q < SIZE; q++) { 27 | printf("%c ", bulbs[r][q]); 28 | } 29 | printf("\n"); 30 | } 31 | 32 | // print Red LED bulb positions 33 | printf("\nRed LED bulb positions\n"); 34 | for (r = 0; r < SIZE; r++) { 35 | for (q = 0; q < SIZE; q++) { 36 | if (bulbs[r][q] == 'R') { 37 | printf("[%d,%d] ", r, q); 38 | } 39 | } 40 | } 41 | 42 | return 0; 43 | } 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Past Papers/2020/June/Online Exam 3/VersionE/2020 June Online 3 Version E - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | //declare array 6 | double price[6]; 7 | 8 | //declare variables 9 | int i ; 10 | double input; 11 | 12 | //taking user inputs of 5 book 13 | for (i = 0 ; i < 6 ; i++) 14 | { 15 | printf("Input the salary of Book No.%d : " , i + 1); 16 | scanf("%lf" , &input); 17 | 18 | //only take inputs > 0 19 | if (input <= 0) 20 | { 21 | printf("Please re-enter the amount!!\n"); 22 | i--; 23 | } 24 | else 25 | { 26 | price[i] = input; 27 | } 28 | } 29 | printf("\n"); 30 | 31 | //display the new price of the books 32 | printf("Book ID\tPrice\n"); 33 | 34 | for (i = 0 ; i < 6 ; i++) 35 | { 36 | //calculate the price reduction of the books 37 | price[i] *= 90.0 / 100; 38 | 39 | printf("%d\t%.2lf\n" , i + 1 , price[i]); 40 | } 41 | 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 5/Version 1 - (chocolate)/V1-(chocolate) - Thushara.c: -------------------------------------------------------------------------------- 1 | // Thushara Thiwanka 2 | #include 3 | 4 | int main(void) { 5 | 6 | float ballSize = 0; 7 | float size[3][5]; 8 | float avgSize[3]; 9 | int i, j; 10 | float avg = 0, temp = 0; 11 | 12 | for(i = 0; i < 3; i++) { 13 | printf("Input for Machine %d\n", i+1); 14 | for(j = 0; j < 5; j++) { 15 | printf("\tSize : "); 16 | scanf("%f", &ballSize); 17 | size[i][j] = ballSize; 18 | } 19 | } 20 | 21 | for(i = 0; i < 3; i++) { 22 | for(j = 0; j < 5; j++) { 23 | temp += size[i][j]; 24 | } 25 | avg = temp / 5; 26 | avgSize[i] = avg; 27 | temp = 0; 28 | } 29 | 30 | for(i = 0; i < 3; i ++) { 31 | printf("Machine %d average size = %f\n", i+1, avgSize[i]); 32 | } 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /C-Assessments/Exercise 4/readme.md: -------------------------------------------------------------------------------- 1 | 2 | ## Question 3 | 4 | Unit price of three items are listed below. 5 | 6 | | ITEM | UNIT PRICE(RS) | 7 | | ----------- | ----------- | 8 | | 1 | 100.00 | 9 | | 2 | 200.00 | 10 | | 3 | 300.00 | 11 | 12 | Implement a function called totalCost() to find and return the total cost. Item number and the quantity purchased from that item should be entered as parameters. Function prototype is given below. 13 | 14 | calculateTotalCost(int itemNo, int quantity); 15 | (Total cost = unit price * quantity). 16 | 17 | Implement a function called printDetails() to print the item number, quantity, and the total cost. Function prototype is given below. 18 | 19 | void printDetails(int itemNo, int quantity, float totalCost); 20 | 21 | In your main function, input item number and the quantity purchased from the keyboard. Call printDetails() function and display the details. -------------------------------------------------------------------------------- /Other Questions/Arrays/01/Untitled1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i,j,k; 6 | int numArr[6]; //variable declaration 7 | int oddNum[6]; 8 | int evenNum[6]; 9 | 10 | int lengthj, lengthk; 11 | j=0; 12 | k=0; 13 | i=0; 14 | 15 | while(i<5) 16 | { 17 | printf("Enter a number :"); 18 | scanf("%d", &numArr[i]); 19 | i++; 20 | } 21 | 22 | printf("\n\nNumber series : "); 23 | 24 | i=0; 25 | while(i<5) 26 | { 27 | printf("%d ", numArr[i]); 28 | 29 | if(numArr[i]%2 == 0) 30 | { 31 | evenNum[j] = numArr[i]; 32 | j++; 33 | } 34 | else 35 | { 36 | oddNum[k] = numArr[i]; 37 | k++; 38 | } 39 | i++; 40 | } 41 | 42 | printf("\n\nEven numbers : "); 43 | 44 | for(i=0;i 2 | 3 | // start the main 4 | int main(void) { 5 | // variable declaration 6 | char char1, char2; // two characters 7 | int lines; // number of lines 8 | int i, j; // counter variables 9 | 10 | // get two characters 11 | printf("Please enter first character : "); 12 | scanf(" %c", &char1); 13 | printf("Please enter second character : "); 14 | scanf(" %c", &char2); 15 | 16 | // get line count 17 | printf("Please enter line count : "); 18 | scanf(" %d", &lines); 19 | 20 | // print with loop 21 | for (i = 0; i < lines; i++) { 22 | for (j = 1; j <= i + 1; j++) { 23 | if (j % 2 == 1) { 24 | printf("%c", char1); 25 | } 26 | else { 27 | printf("%c", char2); 28 | } 29 | } 30 | printf("\n"); 31 | } 32 | 33 | return 0; 34 | } -------------------------------------------------------------------------------- /Other Questions/Arrays/02/Untitled1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i,j,k; 6 | int numArr[10]; //variable declaration 7 | int positiveNum[10]; 8 | int negativeNum[10]; 9 | j=0; 10 | k=0; 11 | i=0; 12 | 13 | while(i<10) 14 | { 15 | printf("Enter a number :"); 16 | scanf("%d", &numArr[i]); 17 | i++; 18 | } 19 | 20 | printf("\n\nNumber series : "); 21 | 22 | i=0; 23 | while(i<10) 24 | { 25 | printf("%d ", numArr[i]); 26 | 27 | if(numArr[i] >= 0) 28 | { 29 | positiveNum[j] = numArr[i]; 30 | j++; 31 | } 32 | else 33 | { 34 | negativeNum[k] = numArr[i]; 35 | k++; 36 | } 37 | i++; 38 | } 39 | 40 | printf("\n\npositive numbers : "); 41 | 42 | for(i=0;i 2 | 3 | int main() 4 | { 5 | double no,check; 6 | int i; 7 | char name[20],dibs[20]; 8 | 9 | FILE *loy; 10 | 11 | loy = fopen("loyalty.dat","r+"); 12 | 13 | if(loy == NULL) 14 | { 15 | printf("Couldn't find such file..."); 16 | return -1; 17 | } 18 | 19 | 20 | for(i=0;i<=4;i++) 21 | { 22 | printf("Enter NAME: "); 23 | scanf("%s",name); 24 | 25 | printf("Enter Loyalty number: "); 26 | scanf("%lf",&no); 27 | 28 | fscanf(loy,"%lf %s",&check,dibs); 29 | while(!feof(loy)) 30 | { 31 | if(check == no) 32 | { 33 | printf("Loyalty Number already exisits....\nRe-enter number...\n"); 34 | printf("Enter Loyalty number: "); 35 | scanf("%lf",&no); 36 | rewind(loy); 37 | } 38 | fscanf(loy,"%lf %s",&check,dibs); 39 | } 40 | fprintf(loy,"%.0lf %s\n",no,name); 41 | rewind(loy); 42 | } 43 | fclose(loy); 44 | } 45 | -------------------------------------------------------------------------------- /Past Papers/2020/June/Online Exam 3/VersionA/2020 June Online 3 Version A - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | //declare array 6 | int rate[5] = {0}; 7 | 8 | //declare variables 9 | int i , input; 10 | 11 | //taking user inputs until user enters -1 12 | printf("Please input the service rating (1 - 5) : "); 13 | scanf("%d" , &input); 14 | 15 | //sort data by the input 16 | while(input != -1) 17 | { 18 | if (input >= 1 && input <= 5) 19 | { 20 | rate[input - 1]++; 21 | } 22 | else 23 | { 24 | printf("Invalid Input!!!\n"); 25 | } 26 | 27 | //taking user inputs until user enters -1 28 | printf("Please input the service rating (1 - 5) : "); 29 | scanf("%d" , &input); 30 | } 31 | printf("\n"); 32 | 33 | //print the collected data 34 | printf("Rating\tNumber of response\n"); 35 | for(i = 0 ; i < 5 ; i++) 36 | { 37 | printf("%d\t%d\n" , i + 1 , rate[i]); 38 | } 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 2/Version 4 - (burgerOutlet)/V 4 - (burgerOutlet) - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | //declare variables 6 | int type , quantity; 7 | float totalPrice; 8 | 9 | //take user input until user enters other than 1 , 2 or 3 to type 10 | printf("Enter Burger Type : "); 11 | scanf("%d" , &type); 12 | 13 | //calculate and retake inputs 14 | while(type == 1 || type == 2 || type == 3) 15 | { 16 | printf("Enter Quantity : "); 17 | scanf("%d" , &quantity); 18 | 19 | switch (type) 20 | { 21 | case 1 : totalPrice = (float)500.00 * quantity; 22 | break; 23 | case 2 : totalPrice = (float)550.00 * quantity; 24 | break; 25 | case 3 : totalPrice = (float)600.00 * quantity; 26 | break; 27 | } 28 | printf("Total Price : %.2f\n" , totalPrice); 29 | printf("\n"); 30 | 31 | printf("Enter Burger Type : "); 32 | scanf("%d" , &type); 33 | } 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 3/VersionD/Version D - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | //declaring array 6 | int num[8]; 7 | 8 | //declaring variables 9 | int i , patten = 0; 10 | 11 | //taking user inputs (numbers between 1 - 4) 12 | for (i = 0 ; i < 8 ; i++) 13 | { 14 | printf("Enter a number (1 - 4) : "); 15 | scanf("%d" , &num[i]); 16 | 17 | if(num[i] > 4 || num[i] < 1) 18 | { 19 | printf("Invalid Input!!\n"); 20 | i--; 21 | } 22 | } 23 | 24 | //printing user inputs 25 | printf("Num Array : "); 26 | for (i = 0 ; i < 8 ; i++) 27 | { 28 | printf("%d " , num[i]); 29 | } 30 | printf("\n"); 31 | 32 | 33 | //checking the given pattern 34 | for (i = 0 ; i < 8 ; i++) 35 | { 36 | if (num[i] == 3 && num[i - 1] == 1) 37 | { 38 | patten++; 39 | } 40 | } 41 | 42 | //getting the output 43 | printf("Number of times the pattern '1 3' appear : %d\n" , patten); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/Answers - Sahan/1AJune1 - Sahan.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i; 5 | char type; 6 | int course[3] = {0,0,0}; 7 | 8 | printf("Press E to exit.\n"); 9 | 10 | for (i = 0; i <= 100; ++i) 11 | { 12 | printf("Enter course type(H/M/F): "); 13 | scanf("%c%*c", &type); 14 | 15 | if (type == 'E' || type == 'e') 16 | break; 17 | 18 | else if (type == 'H' || type == 'h') 19 | ++course[0]; 20 | 21 | else if (type == 'M' || type == 'm') 22 | ++course[1]; 23 | 24 | else if (type == 'F' || type == 'f') 25 | ++course[2]; 26 | 27 | else { 28 | printf("Invalid Input!\n"); 29 | --i; 30 | } 31 | } 32 | 33 | printf("\nCourse\tNo of students\tTotal income"); 34 | printf("\nH\t%d\t\t%.2f", course[0], course[0] * 1500.00); 35 | printf("\nM\t%d\t\t%.2f", course[1], course[1] * 2000.00); 36 | printf("\nF\t%d\t\t%.2f", course[2], course[2] * 2500.00); 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 7/Additional Exercises/Question2-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | int main() 6 | { 7 | int r=1; 8 | float t; 9 | int p; 10 | float d; 11 | 12 | while(r==1){ 13 | printf("Package No: "); 14 | scanf(" %d",&p); 15 | if(p>0 && p<5){ 16 | printf("Total Distance: "); 17 | scanf(" %f",&d); 18 | 19 | 20 | if(p==1) 21 | t= 150 + 175*(d-1); 22 | else if(p==2) 23 | t= 100*d; 24 | else if(p==3) 25 | t= 130 + 150*(d-1); 26 | else if(p==4) 27 | t= 120 + 130*(d-1); 28 | 29 | printf("Total Amount: Rs.%.2f\n",t); 30 | 31 | }else 32 | printf("Invalid Package Number"); 33 | 34 | char n; 35 | printf("Do you have more customers? "); 36 | scanf(" %c",&n); 37 | if(n=='y' || n=='Y') 38 | r=1; 39 | else if((n=='n' || n=='N')) 40 | r=0; 41 | 42 | }//end of while 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /Lab Sheets/2021 Feb Lab Sheets/Lab Sheet 11/Lab sheet 11 - Randula/Excercise 3 - Randula.c: -------------------------------------------------------------------------------- 1 | //importing libraries 2 | #include 3 | 4 | int main(void) 5 | { 6 | //define array 7 | int A[5] = {10 , 20 , 30 , 40 , 50}; 8 | int B[5] = {34 , 67 , 12 , 89 , 12}; 9 | int C[5] = {0}; 10 | //define variable 11 | int i; 12 | 13 | //calculate the multiplication of the array A and B and assign the answers to array C 14 | for (i = 0 ; i < 5 ; i++) 15 | { 16 | C[i] = A[i] * B[i]; 17 | } 18 | 19 | //printf the array A 20 | printf("A = { "); 21 | for (i = 0 ; i < 5 ; i++) 22 | { 23 | printf("%d " , A[i]); 24 | } 25 | printf("}\n"); 26 | 27 | //print the array B 28 | printf("B = { "); 29 | for (i = 0 ; i < 5 ; i++) 30 | { 31 | printf("%d " , B[i]); 32 | } 33 | printf("}\n"); 34 | 35 | //print the array C 36 | printf("C = { "); 37 | for (i = 0 ; i < 5 ; i++) 38 | { 39 | printf("%d " , C[i]); 40 | } 41 | printf("}\n"); 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/Answers - Sahan/1AJune2b - Sahan.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i, j; 5 | char led[4][4]; 6 | 7 | for (i = 0; i < 4; ++i) { 8 | for (j = 0; j < 4; ++j) { 9 | printf("Enter the colour for %d row x %d column LED bulb(R/G/B): ", i+1, j+1); 10 | scanf("%c%*c", &led[i][j]); 11 | 12 | while (led[i][j] != 'R' && led[i][j] != 'G' && led[i][j] != 'B') { 13 | printf("Invalid Input!\nEnter the colour for %d row x %d column LED bulb(R/G/B): ", i+1, j+1); 14 | scanf("%c%*c", &led[i][j]); 15 | } 16 | } 17 | } 18 | 19 | printf("\n"); 20 | 21 | for(i = 0; i < 4; ++i) { 22 | for(j = 0; j < 4; ++j) { 23 | printf(" %c ", led[i][j]); 24 | } 25 | printf("\n"); 26 | } 27 | 28 | printf("\nRed LED bulb positions:\n"); 29 | 30 | for(i = 0; i < 4; ++i) { 31 | for(j = 0; j < 4; ++j) { 32 | 33 | if(led[i][j] == 'R') 34 | printf("[%d,%d] ", i, j); 35 | } 36 | } 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/Answers- Léo/1AJune2b.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | char LED[4][4],choice; 6 | int i,j,counter=1,fin=0; 7 | 8 | for(i=0;i<=3;i++) 9 | { 10 | for(j=0;j<=3;j++) 11 | { 12 | printf("Enter the color %d of the display: ",counter); 13 | scanf("%c%*c",&LED[i][j]); 14 | counter ++; 15 | } 16 | } 17 | 18 | printf("Which colour?(R/B/G): "); 19 | scanf("%c",&choice); 20 | 21 | switch (choice) 22 | { 23 | case('R') : printf("Red LED bulb positions\n"); 24 | break; 25 | case('B') : printf("Blue LED bulb positions\n"); 26 | break; 27 | case('G') : printf("Green LED bulb positions\n"); 28 | break; 29 | default : printf("Unknown colour"); 30 | return -1; 31 | } 32 | 33 | for(i=0;i<=3;i++) 34 | { 35 | for(j=0;j<=3;j++) 36 | { 37 | if(LED[i][j]==choice) 38 | { 39 | printf("[%d,%d] ",i,j); 40 | } 41 | } 42 | } 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /Past Papers/2019/Final Exam/Paper 1A/Answers-Léo/1AQ2b-Léo.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int ratings[3][4]; 6 | int i,j,total=0,movie; 7 | float ave,max = 0; 8 | 9 | for(i=0;i<=2;i++) 10 | { 11 | for(j=0;j<=3;j++) 12 | { 13 | printf("Input the Ratings for movie %d by reviewer %d: ",i+1,j+1); 14 | scanf("%d",&ratings[i][j]); 15 | } printf("\n"); 16 | } 17 | 18 | for(i=0;i<=2;i++) 19 | { 20 | for(j=0;j<=3;j++) 21 | { 22 | printf("%d\t",ratings[i][j]); 23 | }printf("\n"); 24 | } 25 | printf("\n"); 26 | 27 | for(i=0;i<=2;i++) 28 | { 29 | ave = 0; 30 | total = 0; 31 | 32 | for(j=0;j<=3;j++) 33 | { 34 | total += ratings[i][j]; 35 | } 36 | ave = total / 4.0; 37 | printf("Average of movie %d is %.2f\n",i+1,ave); 38 | 39 | if(max< ave) 40 | { 41 | max = ave; 42 | movie = i+1; 43 | } 44 | } 45 | printf("\nThe movie with highest rating is %d with average of %.2f",movie,max); 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /Tutorials/2022 Oct Tutorials/Tutorial 01/Exercise1-shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | printf("Name : Github\n"); // display name 5 | printf("Welcome\nto\nSLIIT\n"); // new line character 6 | printf("Welcome\tto\tSLIIT\n"); // tab 7 | 8 | // shape 1 9 | printf("*********\n"); 10 | printf("*\t*\n"); 11 | printf("*\t*\n"); 12 | printf("*\t*\n"); 13 | printf("*\t*\n"); 14 | printf("*********\n\n\n"); 15 | 16 | // shape 2 17 | printf(" ***\n"); 18 | printf(" * *\n"); 19 | printf("* *\n"); 20 | printf("* *\n"); 21 | printf(" * *\n"); 22 | printf(" ***\n\n\n"); 23 | 24 | // shape 3 25 | printf("*\n"); 26 | printf("**\n"); 27 | printf("***\n"); 28 | printf("****\n"); 29 | printf("*****\n"); 30 | printf("******\n\n\n"); 31 | 32 | // shape 4 33 | printf(" *\n"); 34 | printf(" ***\n"); 35 | printf("*****\n"); 36 | printf(" *\n"); 37 | printf(" *\n"); 38 | printf(" *\n"); 39 | 40 | return 0; 41 | 42 | } // end of main 43 | -------------------------------------------------------------------------------- /Past Papers/2022 June/Final Exam/Session 2/Q1-shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // start the main 4 | int main(void) { 5 | // local variable declaration 6 | int number, digit[4]; 7 | int i, j; // counter variable 8 | 9 | // get correct number 10 | do { 11 | printf("Please enter your 4 digit number : "); 12 | scanf("%d", &number); 13 | if ((number <= 999) || (number >= 10000)) { 14 | printf("Invalid Number\n"); 15 | } 16 | } while ((number <= 999) || (number >= 10000)); 17 | 18 | // separate to digits 19 | digit[0] = number % 10000 / 1000; 20 | digit[1] = number % 1000 / 100; 21 | digit[2] = number % 100 / 10; 22 | digit[3] = number % 10 / 1; 23 | 24 | // check palindrome or not 25 | if ((digit[0] == digit[3]) && (digit[1] == digit[2])) { 26 | printf("It is a Palindrome"); 27 | } 28 | else { 29 | printf("It is not a Palindrome"); 30 | } 31 | 32 | return 0; 33 | } -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/Answers- Léo/1AJune4a.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | char ENo[5],check[5]; 6 | char Name[20],name[20]; 7 | int i,days,present=0,checker,attendance; 8 | 9 | FILE *att; 10 | 11 | att = fopen("attendance.dat","w"); 12 | if(att==NULL) 13 | { 14 | printf("No space to create such file..."); 15 | return -1; 16 | } 17 | 18 | for(i=0;i<=1;i++) 19 | { 20 | days=0; 21 | 22 | printf("Enter Employee Number: "); 23 | scanf("%s",ENo); 24 | 25 | printf("Enter Name: "); 26 | scanf("%s",Name); 27 | 28 | fprintf(att,"%s\t%s\t",ENo,Name); 29 | 30 | while(days<=6) 31 | { 32 | printf("Attendance: "); 33 | scanf("%d",&attendance); 34 | days +=1; 35 | fprintf(att,"%d",attendance); 36 | }fprintf(att,"\n"); 37 | printf("\n\n"); 38 | } 39 | 40 | fclose(att); 41 | 42 | 43 | 44 | return 0; 45 | } 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /Past Papers/2020/June/Online Exam 3/VersionC/2020 June Online 3 Version C - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | double salaries[5]; 6 | 7 | //declare variable 8 | int i; 9 | double input; 10 | 11 | //taking user inputs for 5 employees 12 | for (i = 0 ; i < 5 ; i++) 13 | { 14 | printf("Input the salary of Employee No.%d : " , i + 1); 15 | scanf("%lf" , &input); 16 | 17 | //only take inputs > 0 18 | if (input < 0) 19 | { 20 | printf("Please re-enter the amount!!\n"); 21 | i--; 22 | } 23 | else 24 | { 25 | salaries[i] = input; 26 | } 27 | } 28 | printf("\n"); 29 | 30 | //display the employees' new salary 31 | printf("Employee Number\tSalary\n"); 32 | for (i = 0 ; i < 5 ; i++) 33 | { 34 | //give a 10% increment for employees less than 10000 35 | if (salaries[i] < 10000) 36 | { 37 | salaries[i] *= 110.0 / 100; 38 | } 39 | 40 | //display salaries 41 | printf("%d\t\t%.2lf\n" , i + 1 , salaries[i]); 42 | } 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 10/Question3-Thushara.c: -------------------------------------------------------------------------------- 1 | // including header files 2 | #include 3 | 4 | // main function 5 | int main() { 6 | 7 | // initialize variables 8 | int motion[] = {10, 6, 8, 2, 9}, lengthOfArray, i, firstIndex; 9 | 10 | // array length 11 | lengthOfArray = 5; 12 | 13 | // printing original array 14 | printf("Initial values : "); 15 | for (i = 0; i < lengthOfArray; i++) { 16 | printf("%d ", motion[i]); 17 | } 18 | 19 | // store first element 20 | firstIndex = motion[0]; 21 | 22 | // rotating 23 | for (i = 0; i < lengthOfArray - 1; i++) { 24 | motion[i] = motion[i+1]; 25 | } 26 | 27 | // adding first element in to last element 28 | motion[i] = firstIndex; 29 | 30 | // printing rotated array 31 | printf("\nAfter rotating : "); 32 | for (i = 0; i < lengthOfArray; i++) { 33 | printf("%d ", motion[i]); 34 | } 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 9/Question2-Thushara.c: -------------------------------------------------------------------------------- 1 | #include // including header files 2 | #include 3 | #include 4 | 5 | // function prototype 6 | double hypotenuse(double side1, double side2); 7 | void testHypotenuse(); 8 | 9 | // main function 10 | int main() { 11 | 12 | // function call 13 | testHypotenuse(); 14 | 15 | // print hypotenuse 16 | printf("Triangle 1 Hypotenuse : %f\n", hypotenuse(3.0, 4.0)); 17 | printf("Triangle 2 Hypotenuse : %f\n", hypotenuse(5.0, 12.0)); 18 | printf("Triangle 3 Hypotenuse : %f\n", hypotenuse(8.0, 15.0)); 19 | 20 | return 0; 21 | } 22 | 23 | // function definition 24 | double hypotenuse(double side1, double side2) { 25 | double hypotenuse; 26 | 27 | hypotenuse = sqrt((side1 * side1) + (side2 * side2)); 28 | 29 | return hypotenuse; // return statement 30 | } 31 | 32 | void testHypotenuse() { 33 | assert(hypotenuse(6.0, 8.0) == 10.0); 34 | assert(hypotenuse(10.0, 24.0) == 26.0); 35 | assert(hypotenuse(32.0, 60.0) == 68.0); 36 | } 37 | -------------------------------------------------------------------------------- /Other Questions/Question 8/calculater-nestedif-shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // start the main 4 | int main(void) { 5 | // local variable declaration 6 | float num1, num2, answer; 7 | char operator; 8 | 9 | printf("Enter the first number : "); 10 | scanf("%f", &num1); 11 | 12 | printf("Enter the second number : "); 13 | scanf("%f", &num2); 14 | 15 | printf("Enter the operator (+, -, *, /) : "); 16 | scanf(" %c", &operator); 17 | 18 | // check and calculate 19 | if( operator == '+') { 20 | answer = num1 + num2; 21 | } 22 | else if(operator == '-') { 23 | answer = num1 - num2; 24 | } 25 | else if(operator == '*') { 26 | answer = num1 * num2; 27 | } 28 | else if(operator == '/') { 29 | answer = num1 / num2; 30 | } 31 | else { 32 | printf("\nInvalid Operator"); 33 | } 34 | 35 | // print final answer 36 | if ((operator == '+') || (operator == '-') || (operator == '*') || (operator == '/')) { 37 | printf("Answer = %.2f", answer); 38 | } 39 | 40 | return 0; 41 | } -------------------------------------------------------------------------------- /Past Papers/2019/Final Exam/Paper 1A/Answers - Sahan/1AQ2b-sahan.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i, j, totRate, maxrMovie; 5 | int ratings[3][4]; 6 | float avgRate[3], maxRate; 7 | 8 | maxRate = 0; 9 | 10 | for(i=0; i<3; ++i) 11 | { 12 | for(j=0; j<4; ++j) 13 | { 14 | ratings[i][j] = 0; 15 | 16 | printf("%d review for Movie %d: ", i+1, j+1); 17 | scanf("%d", &ratings[i][j]); 18 | } 19 | printf("\n"); 20 | } 21 | printf("\n"); 22 | for(i=0; i<3; ++i) 23 | { 24 | totRate = 0; 25 | 26 | for(j=0; j<4; ++j) 27 | { 28 | printf("%d ", ratings[i][j]); 29 | totRate += ratings[i][j]; 30 | } 31 | avgRate[i] = totRate / 4.0; 32 | 33 | if(maxRate < avgRate[i]) 34 | { 35 | maxRate = avgRate[i]; 36 | maxrMovie = i+1; 37 | } 38 | 39 | printf("\n"); 40 | } 41 | printf("\nMovie\tRate(avg)"); 42 | for(i=0; i<3; ++i) 43 | { 44 | printf("\n%d\t%.2f", i+1, avgRate[i]); 45 | } 46 | printf("\n\nMovie with highest average rating: %d", maxrMovie); 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/1AQ4a-Thushara.c: -------------------------------------------------------------------------------- 1 | /* Final Paper 2018 2 | * Question 4 Part A 3 | */ 4 | 5 | // including header files 6 | #include 7 | 8 | // main function 9 | int main(void) { 10 | 11 | // declaring variables 12 | FILE *ptr; 13 | char empNum[10], empName[10]; 14 | int status = 0; 15 | int emp, day; 16 | 17 | ptr = fopen("attendance.dat", "w"); 18 | 19 | for (emp = 1; emp <= 2; emp++) { 20 | printf("Emp - %d\n", emp); 21 | printf("Employee Number : "); 22 | scanf(" %10s", empNum); 23 | printf("Employee Name : "); 24 | scanf(" %10s", empName); 25 | fprintf(ptr, "%s\t%s\t", empNum, empName); 26 | 27 | printf("\n0 for absent and 1 for present\n"); 28 | for (day = 1;day <= 7; ) { 29 | printf("\tDay %d : ", day); 30 | scanf("%d", &status); 31 | if (status == 1 || status == 0) { 32 | fprintf(ptr, "%d ", status); 33 | day ++; 34 | } 35 | } 36 | fprintf(ptr, "\n"); 37 | } 38 | 39 | fclose(ptr); 40 | 41 | return 0; 42 | } 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 11/Additional Exercises/Question1(c)-Anjana.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | char stAnswer[3][5]; 6 | char AS[5] = {'F','F','T','T','F'}; 7 | char as[5] = {'f','f','t','t','f'}; 8 | char a; 9 | 10 | for(int i=0;i<3;i++){ 11 | printf("Student %d:\n",i+1); 12 | 13 | for(int j=0;j<5;j++){ 14 | printf("Answer for question %d: ",j+1); 15 | scanf(" %c",&a); 16 | if(a=='t' || a=='T' || a=='f' || a=='F') 17 | stAnswer[i][j]=a; 18 | else{ 19 | printf("re-enter the value\n"); 20 | j-=1; 21 | } 22 | } 23 | printf("\n"); 24 | } 25 | 26 | for(int i=0;i<3;i++){ 27 | int c=0; 28 | for(int j=0;j<5;j++){ 29 | if(stAnswer[i][j]==as[j] || stAnswer[i][j]==AS[j]){ 30 | c+=1; 31 | } 32 | } 33 | printf("Student %d correct answers %d\n",i+1,c); 34 | } 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 05/Exercise 1 C.c: -------------------------------------------------------------------------------- 1 | /*iii) Modify the program written in ii) above display the sum and average of the 2 | positive numbers entered.*/ 3 | 4 | #include 5 | int main(void) 6 | {//function main begins 7 | int count=0; 8 | float no,avg=0,sum=0; 9 | 10 | printf("Input Positive Numbers and This will show Sum and Average of It\n"); 11 | 12 | printf("Input Number : "); 13 | scanf("%f",&no);//get no 14 | 15 | 16 | while (no>=0){//repetition condition 17 | 18 | ++count; 19 | 20 | sum=sum+no;//sum calculation 21 | 22 | avg=sum/count;//avgcalculation 23 | 24 | printf("Sum = %.2f\n",sum); 25 | printf("Count = %d\n",count); 26 | 27 | //show sum,count 28 | 29 | printf("\nInput Number : "); 30 | scanf("%f",&no);//get no 31 | 32 | 33 | 34 | }//end of the while function 35 | 36 | printf("\n\nAverage = %.2f\n",avg);//print average 37 | 38 | printf("\n"); 39 | printf("End Of Reading...."); 40 | 41 | return 0; 42 | 43 | }//end of main function 44 | -------------------------------------------------------------------------------- /Other Questions/Question 8/calculater-switch-shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // start the main 4 | int main(void) { 5 | // local variable declaration 6 | float num1, num2, answer; 7 | char operator; 8 | 9 | printf("Enter the first number : "); 10 | scanf("%f", &num1); 11 | 12 | printf("Enter the second number : "); 13 | scanf("%f", &num2); 14 | 15 | printf("Enter the operator (+, -, *, /) : "); 16 | scanf(" %c", &operator); 17 | 18 | // check and calculate 19 | switch(operator) { 20 | case '+' : { 21 | answer = num1 + num2; 22 | printf("Answer = %.2f", answer); 23 | break; 24 | } 25 | case '-' : { 26 | answer = num1 - num2; 27 | printf("Answer = %.2f", answer); 28 | break; 29 | } 30 | case '*' : { 31 | answer = num1 * num2; 32 | printf("Answer = %.2f", answer); 33 | break; 34 | } 35 | case '/' : { 36 | answer = num1 / num2; 37 | printf("Answer = %.2f", answer); 38 | break; 39 | } 40 | default : { 41 | printf("\nInvalid Operator"); 42 | } 43 | } 44 | 45 | return 0; 46 | } -------------------------------------------------------------------------------- /Past Papers/2021 May/Online Test 1/Version 5 (salary)/Version 5 - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | //declare variables 6 | char position; 7 | float sales , mSalary , comRate , commission , salary; 8 | 9 | //take user inputs 10 | printf("Position : "); 11 | scanf("%c" , &position); 12 | 13 | printf("Sales Amount : "); 14 | scanf("%f" , &sales); 15 | 16 | //calculate the commision and the salary 17 | if (position == 'M' || position == 'm') 18 | { 19 | mSalary = 50000; 20 | } 21 | else if (position == 's' || position == 'S') 22 | { 23 | mSalary = 75000; 24 | } 25 | else 26 | { 27 | printf("Invalid Input!!\n"); 28 | return -1; 29 | } 30 | 31 | if (sales < 30000) 32 | { 33 | comRate = 0; 34 | } 35 | else 36 | { 37 | comRate = 10.0 / 100; 38 | } 39 | 40 | commission = sales * comRate; 41 | 42 | salary = mSalary + commission; 43 | 44 | //display the commission and the salary 45 | printf("Commission : %.2f\n" , commission); 46 | printf("Salary : %.2f\n" , salary); 47 | 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 09/Exercise 3.c: -------------------------------------------------------------------------------- 1 | //Exercise 3 2 | #include 3 | int main( void ) 4 | {//function main begings 5 | int s, p; //declaring variables 6 | double sales[4][5]; //declaring 2d array 7 | double total[5] = {0,0,0,0,0};//declaring 1d array 8 | 9 | for( s = 0 ; s < 4 ; ++s ){//for loop for get inputs begings 10 | 11 | printf( "Sales Person %d \n", s+1 ); 12 | 13 | for( p = 0 ; p < 5 ; ++p ){ 14 | 15 | printf( "Product Number %d\n", p+1 ); 16 | printf( "Input total dollar value of that product sold that day : "); 17 | scanf( "%lf", &sales[s][p]); 18 | 19 | 20 | } 21 | printf( "\n" ); 22 | }//for loop for get inputs ends 23 | 24 | for( p =0 ; p<5 ; ++p ){//for loop for cal total begings 25 | 26 | for( s=0 ; s<4 ; ++s ){ 27 | 28 | total[p] = total[p] + sales[s][p]; 29 | 30 | } 31 | 32 | printf( "Product %d Total sales : %.2f", p+1, total[p]); 33 | printf("\n" ); 34 | }//for loop for cal total ends 35 | 36 | 37 | return 0; 38 | }//end of the main function 39 | -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 2/Version 2 - (purchasedItem)/V 2 - (purchasedItem) - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | //declare variables 6 | int item , quantity; 7 | float totalPrice = 0 , unitPrice; 8 | 9 | //taking user inputs until user enters -1 for item 10 | printf("Enter Item : "); 11 | scanf("%d" , &item); 12 | 13 | while(item != -1) 14 | { 15 | unitPrice = 0; 16 | 17 | printf("Enter Quantity : "); 18 | scanf("%d" , &quantity); 19 | 20 | //calculate the unit price by the input 21 | switch (item) 22 | { 23 | case 1 : unitPrice = (float)300.25 * quantity; 24 | break; 25 | case 2 : unitPrice = (float)145.50 * quantity; 26 | break; 27 | case 3 : unitPrice = (float)525.00 * quantity; 28 | break; 29 | default : printf("Invalid Input!!\n"); 30 | break; 31 | } 32 | totalPrice += unitPrice; 33 | 34 | printf("\n"); 35 | printf("Enter Item : "); 36 | scanf("%d" , &item); 37 | } 38 | printf("Total Price to pay Rs : %.2f\n" , totalPrice); 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 11/Question3-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define SALE 4 4 | #define PRODUCT 5 5 | 6 | int main() 7 | { 8 | float salesProduct[SALE][PRODUCT] = {0}; 9 | int i, j; 10 | float value; 11 | char choice = 'y'; 12 | 13 | while (choice == 'y') { 14 | printf("\nEnter Salesperson Number(1-4) : "); 15 | scanf("%d", &i); 16 | printf("Enter Product Number(1-5) : "); 17 | scanf("%d", &j); 18 | printf("Enter Total dollar Value : $"); 19 | scanf("%f", &value); 20 | 21 | if (i < 1 || j < 1 || i > 4 || j > 5) { 22 | printf("\nInvalid input!!!\n"); 23 | continue; 24 | } 25 | 26 | salesProduct[i-1][j-1] = value; 27 | 28 | printf("\nIf you want to enter more, type 'y' : "); 29 | scanf(" %c", &choice); 30 | 31 | if (choice != 'y') { 32 | break; 33 | } 34 | } 35 | 36 | for (i = 0; i < SALE; i++) { 37 | for (j = 0; j < PRODUCT; j++) { 38 | printf("%d person's %d product sales $%.2f", i+1, j+1, salesProduct[i][j]); 39 | printf("\n"); 40 | } 41 | printf("\n"); 42 | } 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /Small C Excersices/Practice C Language/Answers - Randula/Excercise 4.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int minimum(int number1 ,int number2); 4 | int maximum(int number1 ,int number2); 5 | int multiply(int number1 ,int number2); 6 | 7 | int main (void) 8 | { 9 | int no1 , no2; 10 | 11 | printf("Enter a Value for no 1 : "); 12 | scanf("%d" , &no1); 13 | 14 | printf("Enter a Value for no 2 : "); 15 | scanf("%d" , &no2); 16 | 17 | printf("%d " , minimum(no1 , no2)); 18 | printf("%d " , maximum(no1 , no2)); 19 | printf("%d " , multiply(no1 , no2)); 20 | 21 | return 0; 22 | } 23 | 24 | int minimum(int number1 ,int number2) 25 | { 26 | if (number1 >= number2) 27 | { 28 | return number2; 29 | } 30 | else 31 | { 32 | return number1; 33 | } 34 | } 35 | 36 | int maximum(int number1 ,int number2) 37 | { 38 | if (number1 <= number2) 39 | { 40 | return number2; 41 | } 42 | else 43 | { 44 | return number1; 45 | } 46 | } 47 | 48 | int multiply(int number1 ,int number2) 49 | { 50 | int answer; 51 | 52 | answer = number1 * number2; 53 | 54 | return answer; 55 | } 56 | -------------------------------------------------------------------------------- /C-Assessments/Exercise 6/readme.md: -------------------------------------------------------------------------------- 1 | 2 | ## Question 3 | 4 | An aptitude test of a particular university will take 10 applicants at a time. Those who scored more than the average mark will be qualified to enter the university. Others have to take the test again. Write a C program to enter marks in an array and find the marks which will be qualified. 5 | 6 | (a) Declare an integer array called testMarks of size 10. 7 | (b) Initialize all the array elements to -1. 8 | (c) Read the marks from keyboard and store then in the array. 9 | 10 | If the input a mark less than 0 or grater than 100, display an appropriate error message and ask to re-enter the mark. 11 | 12 | Input format: 13 | 14 | ``` 15 | Input mark 1: 92 16 | Input mark 2: 110 17 | Invalid mark. Please re-enter. 18 | Input mark 2: 76 19 | .................................... 20 | .................................... 21 | Input mark 10: 84 22 | ``` 23 | 24 | (d) Display the marks which will be qualified. 25 | 26 | Example: 27 | 28 | Input array: 29 | 92 76 80 48 66 89 61 56 92 84 30 | Output: 31 | Passed marks: 92 76 80 89 92 84 -------------------------------------------------------------------------------- /C-Assessments/Exercise 7/readme.md: -------------------------------------------------------------------------------- 1 | 2 | ## Question 3 | 4 | An aptitude test of a particular university will take 10 applicants at a time. Those who scored more than the average mark will be qualified to enter the university. Others have to take the test again. Write a C program to enter marks in an array and find how many applicants have failed the test. 5 | 6 | (a) Declare an integer array called marks of size 10. 7 | (b) Initialize all the array elements to -1. 8 | (c) Read the marks from keyboard and store then in the array. 9 | 10 | If the input a mark less than 0 or grater than 100, display an appropriate error message and ask to re-enter the mark. 11 | 12 | Input format: 13 | 14 | ``` 15 | Input mark 1: 92 16 | Input mark 2: 110 17 | Invalid mark. Please re-enter. 18 | Input mark 2: 76 19 | .................................... 20 | .................................... 21 | Input mark 10: 84 22 | ``` 23 | 24 | (d) Display the number of failed candidates. 25 | 26 | Example: 27 | 28 | Input array: 29 | 92 76 80 48 66 89 61 56 92 84 30 | Output: 31 | Number of failed applicants: 4 -------------------------------------------------------------------------------- /Lab Sheets/2021 Feb Lab Sheets/Lab Sheet 11/Lab sheet 11 - Randula/Excercise 5 - Randula.c: -------------------------------------------------------------------------------- 1 | //importing libraries 2 | #include 3 | #include 4 | 5 | //define calling function 6 | void convertToUpperCase (char a[ ], int size ); 7 | 8 | int main (void) 9 | { 10 | //define variables 11 | char address[100]; 12 | int length; 13 | 14 | strcpy(address , "SLIIT, New Kandy Road, Malabe"); //assigning the string by strcpy 15 | 16 | printf("Initiate - %s\n" , address); 17 | 18 | length = strlen(address); //getting the charactor amount by using strlen 19 | 20 | convertToUpperCase (address, length ); //call the function 21 | 22 | 23 | return 0; 24 | } 25 | 26 | //define called function 27 | void convertToUpperCase (char a[ ], int size ) 28 | { 29 | int i; 30 | //modify the string the to convert lower case letters to upper case letters 31 | printf("After Modifing - " ); 32 | for (i = 0 ; i < size ; i++) 33 | { 34 | if (a[i] >= 97) 35 | { 36 | printf("%c" , a[i] - 32); 37 | } 38 | else 39 | { 40 | printf("%c" , a[i]); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/1AQ4b-Thushara.c: -------------------------------------------------------------------------------- 1 | /* Final Paper 2018 2 | * Question 4 Part B 3 | */ 4 | 5 | // including header files 6 | #include 7 | #include 8 | 9 | // main function 10 | int main(void) { 11 | 12 | // declaring variables 13 | FILE *ptr; 14 | char empNumU[10], empNumF[10], empName[10]; 15 | int status[] = {0}; 16 | int day, flag = 0, report = 0; 17 | 18 | ptr = fopen("attendance.dat", "r"); 19 | 20 | printf("Employee Number : "); 21 | scanf(" %s", empNumU); 22 | 23 | while (!feof(ptr)) { 24 | fscanf(ptr, "%s%s", &empNumF, &empName); 25 | 26 | for (day = 1;day <= 7; day++) { 27 | fscanf(ptr, "%d", &status[day-1]); 28 | } 29 | 30 | if (!strcmp(empNumU, empNumF)) { 31 | flag = 1; 32 | break; 33 | } 34 | } 35 | 36 | for (day = 1; day <= 7; day ++) { 37 | if (flag == 1 && status[day - 1] == 1) { 38 | report += 1; 39 | } 40 | } 41 | 42 | printf("\nTotal No of days %s reported to work : %d", empNumU, report); 43 | 44 | fclose(ptr); 45 | 46 | return 0; 47 | } 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionE/versionE-b-Lakshan.c: -------------------------------------------------------------------------------- 1 | //Online Exam01 versionE 2 | #include 3 | #include 4 | 5 | // function prototype 6 | float findRadianValue(float angleInDegrees); 7 | void printRadianValues(void); 8 | 9 | // main function 10 | int main() 11 | { 12 | //function call 13 | printRadianValues(); 14 | 15 | return 0; 16 | } 17 | 18 | // function implementation 19 | float findRadianValue(float angleInDegrees) 20 | { 21 | float radianValue; 22 | 23 | radianValue = M_PI / 180 * angleInDegrees; 24 | 25 | return radianValue; 26 | } 27 | 28 | void printRadianValues(void) 29 | { 30 | float radianValue, angleInDegrees; 31 | int count = 0; 32 | 33 | angleInDegrees = 100; 34 | 35 | printf("Angle(degrees)\tAngle(radians)\n"); 36 | 37 | while(count < 6) 38 | { 39 | radianValue = findRadianValue(angleInDegrees); 40 | 41 | printf("%.0f\t\t\t%.3f\n", angleInDegrees, radianValue); 42 | 43 | count = count + 1; 44 | 45 | angleInDegrees = angleInDegrees + 20; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 06/Exercise 3.c: -------------------------------------------------------------------------------- 1 | /*Exercise 3: Practice to write functions and use those functions to solve a problem 2 | 3 | Write three functions do the following 4 | add - add two integers pass as parameters and return the result 5 | multiply - multiply two integers pass as parameters and return the result 6 | square - receive an integer as a parameter and return the result after multiplying the number by itself. 7 | Use these functions in the main program to calculate the result of the following mathematical expression. 8 | (3*4 + 5*7) 2 */ 9 | 10 | #include 11 | int add(int a,int b); 12 | int multiply(int a, int b); 13 | int square(int x);//declaring function 14 | int main()//function main begins 15 | { 16 | int ans; 17 | ans=square(add(multiply(3,4),multiply(5,7)));//calculation 18 | printf("Answer : %d", ans);//display answer 19 | 20 | return 0; 21 | 22 | } 23 | int add(int a, int b) 24 | { 25 | return a+b; 26 | } 27 | int multiply(int a,int b) 28 | { 29 | return a*b; 30 | } 31 | int square(int a) 32 | { 33 | return a*a; 34 | }//end of main function 35 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 10/Q1/tutorial 1.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(void) 3 | {//function main begins 4 | int number,test;//declaring variables 5 | 6 | FILE *nfptr; 7 | 8 | nfptr = fopen("number.txt","a+");//open file in append plus mode 9 | 10 | if( nfptr == NULL ){ 11 | 12 | printf( "File cannot open\n"); 13 | return -1; 14 | 15 | } 16 | 17 | printf( "Input Number : " ); 18 | scanf( "%d", &number); 19 | 20 | fscanf(nfptr,"%d", &test); 21 | while(!feof(nfptr)){ 22 | 23 | if( test == number ){ 24 | 25 | printf( "\n::Number already in number.dat::\n" ); 26 | return -1; 27 | } 28 | 29 | else{ 30 | 31 | fscanf(nfptr, "%d", &test); 32 | 33 | } 34 | } 35 | 36 | fprintf( nfptr,"%d\t", number); 37 | fclose(nfptr);//close file 38 | 39 | nfptr = fopen("number.txt","r");//open file in reading mode 40 | 41 | fscanf(nfptr, "%d", &number); 42 | 43 | while( !feof(nfptr)){ 44 | 45 | printf("%d\t", number); 46 | fscanf(nfptr, "%d", &number); 47 | 48 | } 49 | fclose(nfptr);//close file 50 | 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/Answers- Léo/1AJune1.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int i=0; 6 | float hm=0,mk=0,fn=0; 7 | char course,des; 8 | 9 | while((i!=100)) 10 | { 11 | printf("Enter Course Type:"); 12 | scanf("%c%*c",&course); 13 | 14 | if((course =='H') || (course =='h')) 15 | { 16 | hm += 1500; 17 | i++; 18 | } 19 | else if ((course =='M') || (course =='m')) 20 | { 21 | mk += 2000; 22 | i++; 23 | } 24 | else if ((course =='F') || (course =='f')) 25 | { 26 | fn += 2500; 27 | i++; 28 | } 29 | else 30 | { 31 | printf("Invalid course.... TRY AGAIN...\n"); 32 | continue; 33 | } 34 | 35 | printf("Do you want to register more students?(Y/N) : "); 36 | scanf("%c%*c",&des); 37 | 38 | if((des == 'N') || (des == 'n')) 39 | { 40 | break; 41 | } 42 | } 43 | 44 | printf("\nTotal fees from DHM is %.2f with %.0f students\n",hm,(hm/1500)); 45 | printf("\nTotal fees from DM is %.2f with %.0f students\n",mk,(mk/2000)); 46 | printf("\nTotal fees from DF is %.2f with %.0f students\n",fn,(fn/2500)); 47 | } 48 | -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 08/Exercise 1 C.c: -------------------------------------------------------------------------------- 1 | /*Exercise 1: Practice to store and print data in an array 2 | ex b C */ 3 | #include 4 | int main( void ) 5 | {//function main begins 6 | int counter; 7 | float marks[10], check_marks; 8 | 9 | for( counter = 1 ; counter <= 10 ; ++counter ){ 10 | 11 | printf( "Input Mark %d : ", counter );//prompt 12 | scanf("%f", &check_marks);//read marks from user 13 | 14 | if( check_marks >= 0 && check_marks <=20 ){// checking condition 15 | 16 | marks[counter] = check_marks; 17 | 18 | } 19 | 20 | else { 21 | 22 | printf( "\n:: Invalid marks :: \n");//prompt 23 | counter = counter - 1 ; // get counter to back 24 | 25 | } 26 | 27 | } 28 | 29 | printf( "\n__________________________________\n" ); 30 | printf( "%s%10s\n","Student","Marks");// make a table 31 | 32 | for ( counter =0; counter < 10; ++counter){//printing for loop begins 33 | 34 | printf( "Student %d%8.2f\n", counter, marks[counter]); 35 | 36 | }// printing for loop ends 37 | 38 | return 0; 39 | }// end of the main function 40 | -------------------------------------------------------------------------------- /Past Papers/2022 June/Final Exam/Session 1/Q2-i-shanelka.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // start the main 4 | int main(void) { 5 | // variable declaration 6 | int numArr[8], newNumArr[8], n; 7 | int i, j = 0; // counter variables 8 | 9 | // get values for numArr 10 | for (i = 0; i < 8; i++) { 11 | printf("Enter value %d : ", i + 1); 12 | scanf("%d", &numArr[i]); 13 | } 14 | 15 | // display numArr values 16 | for (i = 0; i < 8; i++) { 17 | printf("%d\t", numArr[i]); 18 | } 19 | printf("\n"); 20 | 21 | // get n 22 | printf("Enter value for n (n is between 1 - 8) : "); 23 | scanf("%d", &n); 24 | 25 | while ((n < 1) || (n > 8)) { 26 | printf("Please enter valid n value...!\n"); 27 | scanf("%d", &n); 28 | } 29 | 30 | 31 | 32 | 33 | // move numbers 34 | for (i = 0; i < 8 ; i++) { 35 | newNumArr[(i + n) % 8] = numArr[i]; 36 | } 37 | 38 | // print moved numbers 39 | for (i = 0; i < 8; i++) { 40 | printf("%d\t", newNumArr[i]); 41 | } 42 | 43 | return 0; 44 | 45 | } // end of main -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 2/Version 5 - (stationaryShop)/V 5 - (stationaryShop) - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | //declare variables 6 | int itemNo , quantity; 7 | float totalPrice = 0 , unitPrice; 8 | 9 | //taking inputs until user enters -99 to type 10 | printf("Enter Item : "); 11 | scanf("%d" , &itemNo); 12 | 13 | //calculation by the user inputs 14 | while(itemNo != -99) 15 | { 16 | unitPrice = 0; 17 | 18 | printf("Enter Quantity : "); 19 | scanf("%d" , &quantity); 20 | 21 | switch(itemNo) 22 | { 23 | case 1 : unitPrice = (float)30.00 * quantity; 24 | break; 25 | case 2 : unitPrice = (float)45.00 * quantity; 26 | break; 27 | case 3 : unitPrice = (float)55.00 * quantity; 28 | break; 29 | default : printf("Invalid Input!!\n"); 30 | break; 31 | } 32 | 33 | totalPrice += unitPrice; 34 | printf("\n"); 35 | 36 | printf("Enter Item : "); 37 | scanf("%d" , &itemNo); 38 | } 39 | 40 | //printing the calculation result 41 | printf("Total Price to Pay : %.2f\n" , totalPrice); 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /C-Assessments/Exercise 1/question-breakdown.md: -------------------------------------------------------------------------------- 1 | 2 | ## IP-EXERCISE 1: Calculate the increment given for employees: 3 | 4 | 1. Write a function called **calcIncrement()** to calculate and return the increment given for employees. 5 | 6 | ```float calcIcrement(float salary, int noofYearsWorked);``` 7 | 8 | 2. The incrementamount is 10% of the salary. 9 | 10 | 3. Increment is given only to the employees who worked more than 2 years. 11 | 12 | 4. Write a function called **calcTotalSalary()** to calculate the total salary. 13 | 14 | ```float calcTotalSalary(float salary, float increment);``` 15 | 16 | 5. In your **main()** func 17 | 18 | * Enter the salary of an employee and the number of years worked from the keyboard. 19 | * Display the increment 20 | * Display the total salary 21 | 22 | 23 | ## Output 24 | ``` 25 | Enter salary : 26 | Enter number of years worked : 27 | Increment : 28 | Total salary : 29 | ``` 30 | 31 | ____ 32 | 33 | * Note: I didn't had access to most of the IP module questions. So, I got them from [https://hasiyablog.wordpress.com/atsliit/](https://hasiyablog.wordpress.com/atsliit/). -------------------------------------------------------------------------------- /Tutorials/2020 Tutorials/Tutorial 10/Question2-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // main function 4 | int main() 5 | { 6 | // declaring variables 7 | int count, marks, marksList[10], total = 0; 8 | float mean; 9 | 10 | // adding marks to the array 11 | for (count = 1; count <= 10;) { 12 | printf("Enter Marks : "); 13 | scanf("%d", &marks); 14 | 15 | // check if marks between 0 to 20 16 | if (marks > 0 && marks < 20) { 17 | marksList[count] = marks; 18 | count++; 19 | } 20 | } 21 | 22 | // finding total of the marksList array 23 | for (count = 1; count <= 10; count++) { 24 | total += marksList[count]; 25 | } 26 | 27 | // finding mean of the marks 28 | mean = (float)total / 10; 29 | 30 | // printing mean of the marks 31 | printf("\nMean of the marks : %.2f\n", mean); 32 | 33 | // finding indexes 34 | printf("\nIndexes of the students who obtained more than the mean of the marks\n\n"); 35 | for (count = 1; count <= 10; count++) { 36 | if (marksList[count] >= mean) { 37 | printf("%d\t", count); 38 | } 39 | } 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /Past Papers/2021 May/Online Test 1/Version 1 (advertisement)/Version 1 - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | //declare variables 6 | int timeP , noOfTimes; 7 | char pTime; 8 | float amount , peakPrice; 9 | 10 | //take user inputs 11 | printf("Time period : "); 12 | scanf("%d" , &timeP); 13 | 14 | printf("Number of times : "); 15 | scanf("%d" , &noOfTimes); 16 | 17 | printf("Peak Time(Y/N) : "); 18 | scanf("%*c%c" , &pTime); 19 | 20 | //calculate the amount 21 | if (timeP > 60) 22 | { 23 | amount = (float)25000 * noOfTimes; 24 | } 25 | else if (timeP >= 45) 26 | { 27 | amount = (float)12000 * noOfTimes; 28 | } 29 | else 30 | { 31 | amount = (float)75000 * noOfTimes; 32 | } 33 | 34 | if (pTime == 'Y' || pTime == 'y') 35 | { 36 | peakPrice = (float) 20 / 100; 37 | } 38 | else if (pTime == 'N' || pTime == 'n') 39 | { 40 | peakPrice = 0; 41 | } 42 | else 43 | { 44 | printf("Invalid Input!\n"); 45 | return -1; 46 | } 47 | 48 | amount += peakPrice; 49 | 50 | //display total amount 51 | printf("Total amount to be paid : %.2f\n" , amount); 52 | 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /Past Papers/2021 May/Online Test 1/Version 3 (bank)/Version 3 - radser2001.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //function main begins program execution 4 | int main(void) 5 | { 6 | //declaring variables 7 | int age; 8 | float bankBalance; 9 | 10 | //taking age as the user input 11 | printf("Enter your Age: "); 12 | scanf("%d", &age); 13 | 14 | //taking bank balance as the user input 15 | printf("Enter your Bank balance: "); 16 | scanf("%f", &bankBalance); 17 | 18 | 19 | //deciding and displaying the gift 20 | if( age <= 18) 21 | { 22 | if( bankBalance <= 100000 ) 23 | { 24 | printf("\nCongratulations!!!\n"); 25 | printf("\nGift: School Bag"); 26 | } 27 | else 28 | { 29 | printf("\nCongratulations!!!\n"); 30 | printf("\nGift: Tablet "); 31 | } 32 | } 33 | 34 | else if( age > 18 ) 35 | { 36 | if( bankBalance <= 100000) 37 | { 38 | printf("\nCongratulations!!!\n"); 39 | printf("\nGift: Travelling Bank"); 40 | } 41 | else 42 | { 43 | printf("\nCongratulations!!!\n"); 44 | printf("\nGift: Rice Cooker"); 45 | } 46 | } 47 | 48 | 49 | return 0; 50 | 51 | } //end functin main 52 | -------------------------------------------------------------------------------- /Past Papers/2021 May/Online Test 1/Version 3 (bank)/Version3 - radser2001.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | //function main begins program execution 4 | int main(void) 5 | { 6 | //declaring variables 7 | int age; 8 | float bankBalance; 9 | 10 | //taking age as the user input 11 | printf("Enter your Age: "); 12 | scanf("%d", &age); 13 | 14 | //taking bank balance as the user input 15 | printf("Enter your Bank balance: "); 16 | scanf("%f", &bankBalance); 17 | 18 | 19 | //deciding and displaying the gift 20 | if( age <= 18) 21 | { 22 | if( bankBalance <= 100000 ) 23 | { 24 | printf("\nCongratulations!!!\n"); 25 | printf("\nGift: School Bag"); 26 | } 27 | else 28 | { 29 | printf("\nCongratulations!!!\n"); 30 | printf("\nGift: Tablet "); 31 | } 32 | } 33 | 34 | else if( age > 18 ) 35 | { 36 | if( bankBalance <= 100000) 37 | { 38 | printf("\nCongratulations!!!\n"); 39 | printf("\nGift: Travelling Bank"); 40 | } 41 | else 42 | { 43 | printf("\nCongratulations!!!\n"); 44 | printf("\nGift: Rice Cooker"); 45 | } 46 | } 47 | 48 | 49 | return 0; 50 | 51 | } //end functin main 52 | -------------------------------------------------------------------------------- /C-Assessments/Exercise 8/readme.md: -------------------------------------------------------------------------------- 1 | 2 | ## Question 3 | 4 | A company uses an array to store the salaries of their employees. 5 | 6 | Write a C program to do the following. 7 | 8 | (a) Declare a double array called salaries of size 5. 9 | (b) Initialize all the array elements to -1. 10 | (c) Input the salaries of 5 employees from the keyboard and store them in the array. If the user input a negative value, display an error message and ask to re-enter the salary. 11 | 12 | Input format: 13 | 14 | ``` 15 | Input salary of employee 1: 20000.00 16 | Input salary of employee 2: 15000.00 17 | Input salary of employee 3: -1200 18 | Please re-enter the amount. 19 | Input salary of employee 3: 75000.00 20 | ................................... 21 | ................................... 22 | ``` 23 | 24 | (d) The company decided to give a 10% increment for the employees whose salaries are below 10000.00. Update the array accordingly. 25 | 26 | (e) Display the employee number and the new salaries in the following format. 27 | 28 | |Employee number| Salary | 29 | |---------------|---------| 30 | |1 |xxxxxx | 31 | |2 |xxxxxx | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Thushara Thiwanka 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /C-Assessments/Exercise 3/readme.md: -------------------------------------------------------------------------------- 1 | 2 | ## Question 3 | 4 | A security firm has categorized their employees into three grades and a hourly rate is paid based on the grade as follows. 5 | 6 | | GRADE | HOURLY RATE(RS) | 7 | | ----------- | ----------- | 8 | | 1 | 100.00 | 9 | | 2 | 200.00 | 10 | | 3 | 300.00 | 11 | 12 | Implement a function called calculateWeeklySalary() to find and return the weekly salary of an employee. Total number of hours worked during the week and the grade of the employee should be passes as a parameter. Function prototype is given below. 13 | 14 | calculateWeeklySalary(int grade, float hrsWorked); 15 | (Weekly salary = number of hours worked for the week * hourly rate). 16 | 17 | Implement a function called printDetails() to print the grade, hours worked, and the weekly salary of the employee. Function prototype is given below. 18 | 19 | void printDetails(int grade, float hrsWorked, float salary); 20 | 21 | In your main function, input the grade and the total number of hours worked during the week from the keyboard. Call printDetails() function and display the details. -------------------------------------------------------------------------------- /Past Papers/2019/Final Exam/Paper 1A/Answers-Léo/1AQ3-Leo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | float calcAnnualInterest (float interestRate,float amount); 5 | float findTotalAmount (float interestRate,float amount); 6 | void testTotalAmount(); 7 | int main() 8 | { 9 | float amount,rt,fin; 10 | int i; 11 | testTotalAmount(); 12 | printf("Assertion Passed\n\n"); 13 | 14 | printf("Input the amount to be invested: "); 15 | scanf("%f",&amount); 16 | 17 | printf("Input Rate: "); 18 | scanf("%f",&rt); 19 | 20 | if(amount>1000000) 21 | { 22 | rt += 0.5; 23 | } 24 | for(i=1;i<=5;i++) 25 | { 26 | fin =findTotalAmount(rt,amount); 27 | printf("Amount after year %d : %.2f\n",i,fin); 28 | 29 | amount=fin; 30 | } 31 | } 32 | 33 | float calcAnnualInterest (float interestRate,float amount) 34 | { 35 | 36 | return (amount * (interestRate/100)); 37 | } 38 | 39 | float findTotalAmount (float interestRate,float amount) 40 | { 41 | float x; 42 | x = calcAnnualInterest(interestRate,amount); 43 | 44 | return (x+amount); 45 | 46 | } 47 | void testTotalAmount () 48 | { 49 | assert (findTotalAmount(10,10000)==11000); 50 | } 51 | -------------------------------------------------------------------------------- /Past Papers/2020/June/Online Exam 3/VersionB/2020 June Online 3 Version B - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | //declaring array 6 | int seat[10] = {0}; 7 | 8 | //declaring variables 9 | int i , input; 10 | 11 | //taking user inputs until user enters -1 12 | printf("Please input the seat number (1 - 10) : "); 13 | scanf("%d" , &input); 14 | 15 | //sort data by the input 16 | while(input != -1) 17 | { 18 | if (input >= 1 && input <= 10) 19 | { 20 | if ((seat[input - 1]) > 0) 21 | { 22 | printf("The Seat No.%d is reseved!!\n" , input); 23 | } 24 | else 25 | { 26 | seat[input - 1]++; 27 | } 28 | } 29 | else 30 | { 31 | printf("Sorry. Please input a valid seat number!!!\n"); 32 | } 33 | 34 | //taking user inputs until user enters -1 35 | printf("Please input the seat number (1 - 10) : "); 36 | scanf("%d" , &input); 37 | } 38 | printf("\n"); 39 | 40 | //print the collected data 41 | printf("Reserved Seat Numbers : "); 42 | for (i = 0 ; i < 10 ; i++) 43 | { 44 | if (seat[i] > 0) 45 | { 46 | printf("%d " , i + 1); 47 | } 48 | } 49 | 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /Past Papers/2021 Feb/Online Exam 5/Version 4 - (Rainfall)/Version4 (Rainfall) - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | //declare array 6 | int rainfall[3][4]; 7 | 8 | //declare variable 9 | int i , j; 10 | int maxRainfall = 0; 11 | 12 | //taking user input 13 | for (i = 0 ; i < 3 ; i++) 14 | { 15 | printf("Details of day No.%d\n" , i + 1); 16 | for (j = 0 ; j < 4 ; j++) 17 | { 18 | printf("Rainfall of City No.%d : " , j + 1); 19 | scanf("%d" , &rainfall[i][j]); 20 | } 21 | printf("\n"); 22 | } 23 | 24 | //displaying user inputs 25 | for (i = 0 ; i < 3 ; i++) 26 | { 27 | for (j = 0 ; j < 4 ; j++) 28 | { 29 | printf("%d " , rainfall[i][j]); 30 | } 31 | printf("\n"); 32 | } 33 | printf("\n"); 34 | 35 | //displaying maximum rainfall of each day 36 | for (i = 0 ; i < 3 ; i++) 37 | { 38 | maxRainfall = 0; 39 | 40 | printf("Maximum Rainfall of Day No.%d : " , j + 1); 41 | for (j = 0 ; j < 4 ; j++) 42 | { 43 | if (maxRainfall < rainfall[i][j]) 44 | { 45 | maxRainfall = rainfall[i][j]; 46 | } 47 | } 48 | printf("%d\n" , maxRainfall); 49 | } 50 | 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /C-Assessments/Exercise 2/readme.md: -------------------------------------------------------------------------------- 1 | 2 | ## Question 3 | 4 | A hotel has decided to offer 10% discounts from hotel charge for the wedding packages during the festive season. Discount is valid only if the number of guests is more than 200. 5 | (Hotel charge = number of guests * charge per guest). 6 | 7 | You are asked to write a C program to calculate the discount for the wedding package by considering the number of guests. Function should return the discount. Function prototype is given below. 8 | 9 | float getDiscountPrice(int noOfGuests, float chargePerGuest); 10 | 11 | Write a function called getAmount() to calculate the amount to be paid. Function prototype is given below. 12 | (Amount to be paid = (no of guests * charge per guest) – discount)). 13 | 14 | float getAmount(int noOfGuests, float chargePerGuest, float discount); 15 | 16 | In your main function read the number of guests and the charge per guest from keyboard and display the discount and the amount to be paid for wedding package using the functions created above, in the following format. 17 | 18 | ``` 19 | Enter number of guests: 20 | Enter charge per guest: 21 | Discount: 22 | Amount to be paid: 23 | ``` -------------------------------------------------------------------------------- /Tutorials/2021 Feb Tutorials/TUTORIAL 08/Exercise 3.c: -------------------------------------------------------------------------------- 1 | /* Exercise 3: Practice to manipulate data in arrays 2 | Write a C program to create an integer array called Motion of size 5. Ask the user to enter 3 | values to the array from the keyboard. Rotate the values of the array by one position in the 4 | forward direction and display the values. */ 5 | 6 | #include 7 | int main (void) 8 | { //function main begins 9 | int no[5], counter, temp; 10 | 11 | for ( counter =0 ; counter < 5; ++counter ){ //for loop for get input begins 12 | 13 | printf( "Input Number %d : ", counter + 1);//prompt 14 | scanf( "%d", &no[counter]);//read inputs from user 15 | 16 | }//for loop ends 17 | 18 | printf( "Initial values : %d\t %d\t %d\t %d\t %d\n", no[0], no[1], no[2], no[3], no[4]);// print initioal value 19 | 20 | temp = no[0];// use temp 21 | 22 | for( counter =0 ; counter < 4; ++counter){//rotating for loop begins 23 | 24 | no[counter] = no[counter + 1]; 25 | 26 | } 27 | 28 | no[4] = temp; 29 | 30 | printf( "After rotating : %d\t %d\t %d\t %d\t %d\n", no[0], no[1], no[2], no[3], no[4]); 31 | return 0; 32 | }//end of the main function 33 | 34 | -------------------------------------------------------------------------------- /Past Papers/2020/June/Online Exam 3/VersionA/2020juneO3VA-Thushara.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // main function 4 | int main(void) 5 | { 6 | int rate[5] = {0}; 7 | int rating = 1; /* rating to be enterd by user 8 | * rating = 1 for begin while loop 9 | */ 10 | int i; // counter control variable 11 | 12 | // begin while 13 | while (rating != -1) { 14 | 15 | // user input for rating 16 | printf("Pls input the service rating (1- 5): "); // prompt for input 17 | scanf("%d", &rating); 18 | 19 | // check if rating valid 20 | if (rating >= 1 && rating <= 5) { 21 | rate[rating-1] += 1; // store the number of response for rate 22 | } // end if 23 | 24 | else if (rating == -1) { 25 | break; 26 | } // end else if 27 | 28 | // invalid rating error message 29 | else { 30 | printf("Invalid Input\n"); 31 | continue; 32 | } // end else 33 | }// end while 34 | 35 | printf("\nRating\tNumber of response\n"); // prompt 36 | // loop each element in array 37 | for (i = 0; i < 5; i++) { // loop 5 times 38 | printf("%d\t%d\n", i+1, rate[i]); // print results 39 | } 40 | 41 | return 0; 42 | 43 | } // end function main 44 | 45 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 2/VersionD/Version D - Randula/Q2 - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | float calculateTotalCost(int itemNo, int quantity); 4 | void printDetails(int itemNo, int quantity, float totalCost); 5 | 6 | int main (void) 7 | { 8 | int itemNo , quantity; 9 | float totalCost; 10 | 11 | printf("Enter Item No : "); 12 | scanf("%d" , &itemNo); 13 | 14 | printf("Enter Quantity : "); 15 | scanf("%d" , &quantity); 16 | 17 | totalCost = calculateTotalCost(itemNo, quantity); 18 | printDetails(itemNo , quantity, totalCost); 19 | 20 | return 0; 21 | } 22 | 23 | float calculateTotalCost(int itemNo, int quantity) 24 | { 25 | float totalCost; 26 | 27 | if (itemNo == 1) 28 | { 29 | totalCost = 100.00 * quantity; 30 | } 31 | else if (itemNo == 2) 32 | { 33 | totalCost = 200.00 * quantity; 34 | } 35 | else if (itemNo == 3) 36 | { 37 | totalCost = 300.00 * quantity; 38 | } 39 | 40 | return totalCost; 41 | } 42 | 43 | void printDetails(int itemNo, int quantity, float totalCost) 44 | { 45 | printf("Item No : %d\n" , itemNo); 46 | printf("Quantity : %d\n" , quantity); 47 | printf("Total Cost : Rs.%.2f\n" , totalCost); 48 | } 49 | -------------------------------------------------------------------------------- /Past Papers/2020/September/Online Exam 3/VersionC/Version C - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | //declaring arrays 6 | int myArray[10] , largeNum[10]; 7 | 8 | //declaring variables 9 | int i , largeNo , lrgNo = 0; 10 | int total = 0; 11 | float average ; 12 | 13 | //taking user inputs 14 | for (i = 0 ; i < 10 ; i++) 15 | { 16 | printf("Enter a Number : "); 17 | scanf("%d" , myArray[i]); 18 | } 19 | 20 | //calculate total and average 21 | for (i = 0 ; i < 10 ; i++) 22 | { 23 | total += myArray[i]; 24 | } 25 | average = (float) total / 10; 26 | 27 | printf("Average : %.1f\n" , average); 28 | 29 | //printing myArray 30 | printf("My Array : "); 31 | for (i = 0 ; i < 10 ; i++) 32 | { 33 | printf("%d " , myArray[i]); 34 | } 35 | 36 | //assigning values to largeNum array 37 | for (i = 0 ; i < 10 ; i++) 38 | { 39 | if (myArray[i] > (int)average) 40 | { 41 | largeNum[lrgNo] = myArray[i]; 42 | lrgNo++; 43 | } 44 | } 45 | printf("\n"); 46 | 47 | //printing largeNum 48 | printf("largeNum : "); 49 | for (i = 0 ; i < lrgNo ; i++) 50 | { 51 | printf("%d " , largeNum[i]); 52 | } 53 | 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /Past Papers/2018 June/Final Exam/Paper 1A/2018 - Randula/4A - Randula.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main (void) 4 | { 5 | //define strings 6 | char emp_no[3]; 7 | char name[20]; 8 | //define array 9 | int status[7] ; 10 | //define variabele 11 | int i; 12 | 13 | //define file 14 | FILE *atdPtr; 15 | atdPtr = fopen("attendance.dat" , "a"); //open attendance.dat file for append 16 | 17 | //take inputs from the user 18 | printf("Enter the Employee Number : "); 19 | scanf("%s" , emp_no); 20 | 21 | printf("Enter the Employee Name : "); 22 | scanf("%s" , name); 23 | 24 | for (i = 0 ; i < 7 ; i++ ) 25 | { 26 | printf("Enter the attendance of the week for the day %d : " , i + 1); 27 | scanf("%d" , &status[i]); 28 | 29 | if(status[i] != 0 && status[i] != 1) //discard an invalid input and retake 30 | { 31 | printf("Invalid Input!! Try Again!!\n"); 32 | i--; 33 | } 34 | } 35 | 36 | //adding data to the attendance.dat file 37 | fprintf(atdPtr ,"%s\t%s\t" , emp_no , name); 38 | for (i = 0 ; i < 7 ; i++) 39 | { 40 | fprintf(atdPtr ,"%d " , status[i]); 41 | } 42 | 43 | //close attendance.dat file 44 | fclose(atdPtr); 45 | return 0; 46 | } 47 | --------------------------------------------------------------------------------