1 / 25

Writing a computer program involves performing the following tasks. Understanding the problem

Solving a problem. Different steps in solving a problem. Writing a computer program involves performing the following tasks. Understanding the problem Developing an Algorithm for the problem Writing a Computer Program Testing the Computer program.

Download Presentation

Writing a computer program involves performing the following tasks. Understanding the problem

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Solving a problem Different steps in solving a problem • Writing a computer program involves performing the following tasks. • Understanding the problem • Developing an Algorithm for the problem • Writing a Computer Program • Testing the Computer program IT Department - National Institute of Education

  2. Lets take a problem and try to solve the problem Problem : Add two numbers and display total. IT Department - National Institute of Education

  3. STEP 1 – Understand the problem How do you solve that problem ? The first task is to understand the problem clearly Find out the inputs ? Here the input should be two numbers. IT Department - National Institute of Education

  4. Find outputs ? Total. So there must be some calculation to get the total. That is Process. IT Department - National Institute of Education

  5. 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. A Graphical representation of making a cup of tea Start Boilwater Put tea powder to mug Add some sugar Serve This Representation is called as Flow Chart Stop End Show IT Department - National Institute of Education

  7. Flowchart A graphical representation of the sequence of operations in a program is called Flow Chart. flowchart shows how data flows and operates IT Department - National Institute of Education

  8. Symbols used in Flow chart Process Start/Stop Decision Yes No Input/Output Flow line IT Department - National Institute of Education

  9. A Graphical representation to add two numbers Start Input two numbers Calculate total Display total Stop This Representation is called as Flow Chart End Show IT Department - National Institute of Education

  10. Stop Start Input Age Adult child Draw a flow chart to find adult or child. Yes No Ifage>=18 IT Department - National Institute of Education

  11. Start Stop Draw a flow chart to cross the road. Go to pavement Look at left & right Yes No Are clear both ways? Cross the road Wait IT Department - National Institute of Education

  12. Draw a flow chart to find the correct key from a bunch keys to open the door. Start Tryout a key Can the door be opened Yes No Try the next key Stop IT Department - National Institute of Education

  13. Problem Solving 1 Input name, Maths and Science marks and calculate Total. Display Name & Total Marks . Solve & design the above problem in Flow chart. IT Department - National Institute of Education

  14. Conti.. Start Input Name, Maths Mks , Science Mks Total= Maths + Science Display Name,Total Stop End Show IT Department - National Institute of Education

  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. Start InputAverage IfAvg>=60 No Yes FAIL PASS Display Grade Stop IT Department - National Institute of Education

  17. Problem Solving 3 Draw a flow chart to input Average Marks and find the grade according to the grade System given below. 75 - 100 “A” 65 - 74 “B” 55 - 64 “C” 45 - 54 “S” 0 - 44 “F” IT Department - National Institute of Education

  18. Input Avg Stop Start Yes If Avg>=75 Display A No Yes Display B If Avg>=65 No Yes If Avg>=55 Display C No Yes Display S If Avg>=45 No Display F IT Department - National Institute of Education

  19. Draw a flow chart to print numbers from1 to 10 Start Number=1 No Is Number < =10 Number=Number+1 Yes Print Number Stop IT Department - National Institute of Education

  20. Pseudo Code One of the textual representation of algorithm is Pseudo code. IT Department - National Institute of Education

  21. Pseudo Code for adding two numbers Begin Input first number and second number Total = first Number + Second Number output Total End. IT Department - National Institute of Education

  22. Write a pseudo code to take maths and science marks , calculate total, average and display grade. (If average >=60, “Pass” otherwise “Fail”. 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 IT Department - National Institute of Education

  23. Write a pseudo code to input Average Marks and find the grade according to the grade System given below. 75 - 100 “A” 65 - 74 “B” 55 - 64 “C” 45 - 54 “S” 0 - 44 “F” IT Department - National Institute of Education

  24. 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 End if End if End if Display Grade End IT Department - National Institute of Education

  25. Write a Pseudo code to display numbers from 1 to 10 Begin Number=1 Do While Number <=10 Print Number Number=Number + 1 End while End IT Department - National Institute of Education

More Related