0% found this document useful (0 votes)
32 views16 pages

PSP Unit 1 AlgorithmsFlowchart 29 6 2022 3pm

This document contains a lecture on problem-solving through programming. It introduces algorithms and flowcharts. An algorithm is defined as a step-by-step procedure to solve a problem. Properties of algorithms like input, output, definiteness, and finiteness are described. Examples of algorithms to find the sum of two numbers, area and circumference of a circle, and largest of two numbers are provided. The symbols used in a flowchart like ovals, parallelograms, rectangles, and diamonds are explained. Corresponding flowcharts for the example algorithms are given. Additional algorithms and flowcharts presented include finding if a number is even or odd and swapping two numbers using a temporary variable. The instructor's contact details are provided

Uploaded by

povir39461
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views16 pages

PSP Unit 1 AlgorithmsFlowchart 29 6 2022 3pm

This document contains a lecture on problem-solving through programming. It introduces algorithms and flowcharts. An algorithm is defined as a step-by-step procedure to solve a problem. Properties of algorithms like input, output, definiteness, and finiteness are described. Examples of algorithms to find the sum of two numbers, area and circumference of a circle, and largest of two numbers are provided. The symbols used in a flowchart like ovals, parallelograms, rectangles, and diamonds are explained. Corresponding flowcharts for the example algorithms are given. Additional algorithms and flowcharts presented include finding if a number is even or odd and swapping two numbers using a temporary variable. The instructor's contact details are provided

Uploaded by

povir39461
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Course – PROBLEM-SOLVING

THROUGH PROGRAMMING

Course Instructor
Dr. Umadevi V
Department of CSE, BMSCE
Webpage:https://sites.google.com/site/drvumadevi/

February 25, 2024 CSE, BMSCE 1


Unit-1

Introduction to Computer Hardware


and Software: Algorithms and flowchart.

February 25, 2024 CSE, BMSCE 2


What is an Algorithm ?
Algorithm is a step – by – step procedure which is helpful in solving a
problem. If, it is written in English like sentences then, it is called as
‘PSEUDO CODE’.

Properties of an Algorithm
 Input: An algorithm may or may not require input
 Output: Each algorithm is expected to produce at least
one result
 Definiteness: Each instruction must be clear and
unambiguous.
 Finiteness: If the instructions of an algorithm are
executed, the algorithm should terminate after finite
number of steps

February 25, 2024 CSE, BMSCE 3


Example
Algorithm to find the sum of two numbers

Step-1: Start
Step-2: Input two numbers say A and B
Step-3: Compute SUM = A + B
Step-4: Display SUM
Step-5: Stop

February 25, 2024 CSE, BMSCE 4


Example
Algorithm to find Area and Circumference of Circle

Step-1: Start
Step-2: Input Radius of Circle say R
Step-3: Area = 3.142 x R x R
Step-4: Circumference = 2 x 3.142 x R
Step-5: Display Area, Circumference
Step-6: Stop

February 25, 2024 CSE, BMSCE 5


Flowchart

 A flowchart is a diagrammatic representation of


an algorithm. A flowchart can be helpful for
both writing programs and explaining the
program to others.

February 25, 2024 CSE, BMSCE 6


Symbols Used In Flowchart
Symbol Name Symbol Description

Oval Used to represent start and end of


flowchart

Parallelogram Used for input and output


operation

Rectangle Processing: Used for arithmetic


operations and data manipulations

Diamond Decision making. Used to


represent the operation in which
there are two/three alternatives,
true and false etc.
Arrows Flow line Used to indicate the flow
of logic by connecting symbols

February 25, 2024 CSE, BMSCE 7


Example
Flow chart to find the sum of two numbers

February 25, 2024 CSE, BMSCE 8


Example
Flowchart to find area and circumference of a circle.

February 25, 2024 CSE, BMSCE 9


Algorithm and Flowchart to find Largest of two numbers

Algorithm
Step-1: Start
Step-2: Input two numbers say NUM1,NUM2
Step-3: IF NUM1 > NUM2 THEN
print largest is NUM1
ELSE print largest is NUM2
ENDIF
Step-4: Stop

February 25, 2024 CSE, BMSCE 10


Algorithm and Flowchart to find Largest of two numbers

Algorithm
Step-1: Start
Step-2: Input two numbers say NUM1,NUM2 Flowchart
Step-3: IF NUM1 > NUM2 THEN
print largest is NUM1
ELSE print largest is NUM2
ENDIF
Step-4: Stop

February 25, 2024 CSE, BMSCE 11


Flowchart to find the largest of three numbers

Input Value

February 25, 2024 CSE, BMSCE 12


Algorithm to find the largest of three numbers

February 25, 2024 CSE, BMSCE 13


Algorithm and Flowchart to find whether given number is Even or Odd

Algorithm Flowchart
Step-1: Start
Step-2: Input number say NUM Start
Step-3: Remainder=NUM%2
Step-3: IF Remainder == 0 THEN Enter NUM
Print Even
ELSE
Remainder= NUM % 2
Print Odd
ENDIF
Step-4: Stop
True If False
Remainder ==0

Print Even
Print Odd

Note:
% is a remainder Operator,
Which returns the remainder value
Stop
February 25, 2024 CSE, BMSCE 14
Algorithm & Flowchart to Swap Two Numbers using Temporary Variable

February 25, 2024 CSE, BMSCE 15


Thanks for Listening

My contact details
Dr. Umadevi V, Associate Professor, Department of CSE, BMSCE
Staff Room: 4th floor, New Academic block

[email protected]

8762742909

February 25, 2024 CSE, BMSCE 16

You might also like