







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








Introduction to Computing / Computer Science
1. Introduction to Problem Solving What is Problem Solving? Problem solving is the process of identifying a problem, understanding it, and finding a suitable solution step by step. In computer science, problem solving means developing a logical way to solve a problem with the help of a computer. A computer cannot solve a problem by itself unless we provide clear instructions. We must first understand the problem and then tell the computer what steps to perform. Real-life example: Suppose you want to calculate the total marks of a student. You need to: 1. Take marks of different subjects. 2. Add all the marks. 3. Calculate the total. 4. Display the result. These steps represent a simple problem-solving process. Why is Problem Solving Important? Problem solving is important because: 1. Improves logical thinking: It helps us think logically and understand how to solve different problems. 2. Saves time: A well-planned solution reduces unnecessary steps. 3. Reduces errors: Understanding the problem before programming helps avoid mistakes. 4. Improves programming skills: It helps programmers develop correct and efficient programs. 5. Provides better solutions: It helps us select the most suitable way to solve a problem. Steps Involved in Problem Solving There are several important steps involved in solving a problem. **Problem-Solving Process
2. Problem Analysis Identify the required inputs and outputs. 3. Designing the Solution Prepare an algorithm, flowchart or pseudocode. 4. Implementation Convert the solution into a programming language. 5. Testing and Debugging Check the program and correct errors. 6. Final Result Obtain the correct solution. Example: If we want to calculate the area of a rectangle: ļ· Problem identification: Find the area of a rectangle. ļ· Analysis: We need length and width. ļ· Design: Multiply length by width. ļ· Implementation: Write the program. ļ· Testing: Check the answer. ļ· Result: Display the area. Formula: Area = LengthtimesWidth
Example: Start, Stop
2. Process (Rectangle) Shows a calculation or processing step. Example: Sum = A + B 3. Decision (Diamond) Checks a condition and gives different paths, such as Yes or No. Example: Is age greater than 18? 4. Input/Output (Parallelogram) Used to take input or display output. Example: Input A, Display Sum 5. Flow Line (Arrow) Shows the direction and order of execution. 6. Connector (Circle) Connects different parts of a flowchart. Example: Connector A Example: Flowchart to Add Two Numbers Addition Flowchart Read from top to bottom, following the arrows. Explanation: ļ· Start: The flowchart begins. ļ· Input A, B: The user enters two numbers. ļ· Sum = A + B: The computer adds both numbers. ļ· Display Sum: The answer is shown. ļ· Stop: The flowchart ends. Advantages of Flowcharts 1. Easy to understand because they use graphical symbols. 2. Help explain the logic of a program. 3. Make errors easier to identify. 4. Improve communication between programmers. 5. Help in program planning and documentation. Limitations of Flowcharts 1. Large flowcharts can become complicated.
Explanation: ļ· START: Begins the program. ļ· INPUT A: Takes the first number. ļ· INPUT B: Takes the second number. ļ· SET SUM: Adds both numbers and stores the answer. ļ· OUTPUT SUM: Displays the result. ļ· STOP: Ends the program. Example 2: Pseudocode to Calculate Student Average START INPUT English INPUT Computer INPUT Mathematics SET Total = English + Computer + Mathematics SET Average = Total / 3 OUTPUT Total OUTPUT Average STOP Suppose the marks are: ļ· English = 70 ļ· Computer = 80 ļ· Mathematics = 90 Total = 240 Average = 80 Advantages of Pseudocode
Area = 54= Final Output: 20 Example 2: Calculate Simple Interest Problem: Calculate simple interest using principal, rate and time. Formula: SI = PR*T Where: ļ· P = Principal amount (initial money) ļ· R = Rate of interest ļ· T = Time period
Example calculation: P = 10,
The simple interest is 1,000. Example 3: Calculate the Total and Average of Five Subjects Problem: A student has marks in five subjects. Calculate the total and average marks.
SET Total = M1 + M2 + M3 + M4 + M SET Average = Total / 5 OUTPUT Total OUTPUT Average STOP Example: Subject Marks English 70 Computer 80 Mathematics 90 Physics 75 Chemistry 85 Total 400