Download presentation
Presentation is loading. Please wait.
Published byChristopher Small Modified over 9 years ago
1
End Show Writing a computer program involves performing the following tasks. 1. Understanding the problem 2. Developing an Algorithm for the problem 3. Writing a Computer Program 4. Testing the Computer program Different steps in solving a problem Solving a problem IT Department - National Institute of Education
2
End Show Lets take a problem and try to solve the problem Add two numbers and display total. Problem : IT Department - National Institute of Education
3
End Show How do you solve that problem ? The first task is to understand the problem clearly STEP 1 – Understand the problem Here the input should be two numbers. Find out the inputs ? IT Department - National Institute of Education
4
End Show That is Process. Find outputs ? Total. So there must be some calculation to get the total. IT Department - National Institute of Education
5
End Show STEP 2 – Developing an Algorithm for the problem The method that used to solve the problem is called algorithm Algorithm can be represented in two ways 1. Graphically 2. Textually IT Department - National Institute of Education
6
Boil water Add some sugar Put tea powder to mug Start Stop Serve A Graphical representation of making a cup of tea This Representation is called as Flow Chart IT Department - National Institute of Education End Show
7
A graphical representation of the sequence of operations in a program is called Flow Chart. Flowchart flowchart shows how data flows and operates IT Department - National Institute of Education
8
End Show Symbols used in Flow chart Start/Stop Input/Output Decision Flow line Process YesNo IT Department - National Institute of Education
9
Calculate total Start Stop A Graphical representation to add two numbers This Representation is called as Flow Chart Input two numbers Display total IT Department - National Institute of Education End Show
10
Draw a flow chart to find adult or child. Stop Input Age If age>=18 Adultchild Start YesNo IT Department - National Institute of Education
11
End Show Draw a flow chart to cross the road. Are clear both ways? Go to pavement No Cross the road Wait Yes Start Stop Look at left & right IT Department - National Institute of Education
12
End Show Draw a flow chart to find the correct key from a bunch keys to open the door. Can the door be opened Tryout a key No Try the next key Yes Start Stop IT Department - National Institute of Education
13
End Show Input name, Maths and Science marks and calculate Total. Display Name & Total Marks. Solve & design the above problem in Flow chart. Problem Solving 1 IT Department - National Institute of Education
14
Start Input Name, Maths Mks, Science Mks Total= Maths + Science Display Name,Total Stop Conti.. IT Department - National Institute of Education End Show
15
Problem Solving 2 Draw Flow chat to input Average Marks and display Pass or fail (If Average>= 60, “Pass” otherwise “Fail”) IT Department - National Institute of Education
16
End Show Start If Avg>=60 No PASS Display Grade FAIL Stop Yes Input Average IT Department - National Institute of Education
17
End Show 75 - 100 “A” 65 - 74 “B” 55 - 64 “C” 45 - 54 “S” 0 - 44 “F” Draw a flow chart to input Average Marks and find the grade according to the grade System given below. Problem Solving 3 IT Department - National Institute of Education
18
End Show Input Avg If Avg>=75 If Avg>=65 If Avg>=55 If Avg>=45 Stop Start Display A Display B Display C Display S Yes No Display F IT Department - National Institute of Education
19
End Show Start Is Number < =10 No Print Number Stop Yes Number=1 Number=Number+1 Draw a flow chart to print numbers from1 to 10 IT Department - National Institute of Education
20
End Show One of the textual representation of algorithm is Pseudo code. Pseudo Code IT Department - National Institute of Education
21
End Show Begin Pseudo Code for adding two numbers End. Input first number and second number Total = first Number + Second Number output Total IT Department - National Institute of Education
22
End Show Begin Input Maths Marks,Science Marks Total = Maths + Science Average = Total / 2 If Average >= 60 then Grade= “PASS” Else Grade= “FAIL” End if Display Total, Average, Grade End Write a pseudo code to take maths and science marks, calculate total, average and display grade. (If average >=60, “Pass” otherwise “Fail”. IT Department - National Institute of Education
23
End Show 75 - 100 “A” 65 - 74 “B” 55 - 64 “C” 45 - 54 “S” 0 - 44 “F” Write a pseudo code to input Average Marks and find the grade according to the grade System given below. IT Department - National Institute of Education
24
End Show Begin Input Avg Mks If Avg >=75 then Grade = “A” Else If Avg >=65 then Grade =“ B” Else If Avg >=55 then Grade = “C” Else If Avg >= 45 then Grade =“ S” Else Grade = “W” End if Display Grade End IT Department - National Institute of Education
25
End Show Begin Number=1 Do While Number <=10 Print Number Number=Number + 1 End while End Write a Pseudo code to display numbers from 1 to 10 IT Department - National Institute of Education
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.