Your SlideShare is downloading. ×
Cs 1114 - lecture-2
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Cs 1114 - lecture-2


Published on

Published in: Technology, Education

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Programming Fundamentals
  • 2. This Course Problem Solving Using Computers Implementing the Solution using a Programming Language 1 2 The first part is mostly ignored which leads to poor programming skills Programming Fundamentals | Lecture-2
  • 3. 1
  • 4. Steps in Problem Solving Define the Problem Design the Solution 1 2 Programming Fundamentals | Lecture-2
  • 5. 1. Define the Problem
    • After careful reading, the problem should be divided into three separate components
      • Input
        • Data provided to the problem
      • Output
        • What is required from the solution
      • Processing
        • List of actions needed to produce the required output
    Programming Fundamentals | Lecture-2
  • 6. 2. Design the Solution Solution of a Problem in your mind Solution in terms of no. of steps Transform There are more than 1 ways to do that but we will use a graphical approach which will involve usage of Geometrical Shapes to represent different kinds of steps in a solution Programming Fundamentals | Lecture-2
  • 7. Example-1 Programming Fundamentals | Lecture-2
  • 8. Step-1: Define the Problem Programming Fundamentals | Lecture-2 Problem : Find the sum of two numbers Input Output Processing Number1 Sum Add Numbers Together Number2
  • 9. Step-2: Design the Solution
    • Start by drawing a “Start” symbol
    • Show a symbol for Input
    • Show process symbol(s) for processing
      • There can be more than 1 such steps depending on the complexity of the problem
    • Show a symbol for Output
    • Finish by drawing a “Stop” Symbol
    Programming Fundamentals | Lecture-2
  • 10. Step-2: Design the Solution Programming Fundamentals | Lecture-2 START READ number1, number2 sum = number1 + number2 DISPLAY sum STOP
  • 11. Legend Programming Fundamentals | Lecture-2 Symbol Meaning Terminal Symbol (Oval) : indicates the beginning and ending of a program Input-Output Symbol (Parallelogram): shows an input or an output operation Process Symbol (Rectangle): shows an instruction other than input or output
  • 12. Other Simple Examples
    • Find sum of three numbers
    • Division, multiplication, subtraction of two/three numbers
    • Find Average of two numbers
    • Find square of a number
    • Find acceleration for a given velocity and time
    • Find Velocity
    Programming Fundamentals | Lecture-2
  • 13. Average of Two Numbers Programming Fundamentals | Lecture-2 START READ number1, number2 sum = number1 + number2 DISPLAY average STOP average = sum / 2
  • 14. Square of a Number Programming Fundamentals | Lecture-2 START READ number square = number * number DISPLAY square STOP
  • 15. Acceleration Programming Fundamentals | Lecture-2 START READ v1, v2, t change = v2 – v1 DISPLAY acceleration STOP acceleration = change / t
  • 16. Velocity Programming Fundamentals | Lecture-2 START READ d1, d2, t1, t2 positionChange = d2 – d1 DISPLAY velocity STOP timeChange = t2 – t1 velocity = postionChange / timeChange
  • 17. Why to use Computers?
    • Can do many complicated tasks at very high speeds and can store large quantities of data
    • Some Situations
      • Extensive Input
      • Extensive output
      • Method of solution is too complicated to implement manually
      • If done manually, it takes an excessive long time to solve
  • 18. Tasks (to be done before next lecture)
    • Calculate area of a rectangle
      • area = base  height
    • Find Cube of a Number
    • Calculate Marks Percentage
      • (marks obtained / total marks)  100
    • Calculate Sales Tax
      • amount  (tax percent / 100)
    • Find “no. of minutes” and “no. of seconds” for given “no of years”
    Programming Fundamentals | Lecture-2
  • 19. Programming Fundamentals | Lecture-2 BE READY FOR QUIZ IN NEXT LECTURE