0% found this document useful (0 votes)
416 views6 pages

1experiment: 1: Aim: To Study Algorithm and Flow Charts Learning Outcomes: Learner Would Be Able To

The document provides instructions for an experiment on algorithms and flowcharts. It includes definitions of algorithms and flowcharts, their key components, and examples. Students are asked to write algorithms and draw flowcharts for 4 problems. They are also asked to reflect on their learning and answer 3 homework questions involving writing additional algorithms and flowcharts.

Uploaded by

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

1experiment: 1: Aim: To Study Algorithm and Flow Charts Learning Outcomes: Learner Would Be Able To

The document provides instructions for an experiment on algorithms and flowcharts. It includes definitions of algorithms and flowcharts, their key components, and examples. Students are asked to write algorithms and draw flowcharts for 4 problems. They are also asked to reflect on their learning and answer 3 homework questions involving writing additional algorithms and flowcharts.

Uploaded by

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

Mukesh Patel School of Technology Management & Engineering, SVKM’s NMIMS University

COURSE: Programming for Problem Solving

1Experiment: 1
PART A

(PART A: TO BE REFFERED BY STUDENTS)

Aim: To study Algorithm and Flow charts

Learning Outcomes: Learner would be able to

1. Interpret the steps of algorithm into a flowchart.


2. Explain the features of each symbol of the flowchart.
3. Analysis the scenario to write algorithm and flowchart (breaking the problem into steps of
selection, sequence).

Task 1:

For the following Problem Statements write Algorithm and Draw a Flowchart.

1. Krishna goes to market for buying milk and vegetables. He is having a currency of Rs.500
with him. From a shop he purchases 2.0 liters Milk priced Rs.50.0 per liter, 1.5 kg Carrots
priced Rs.35.0 per kg, 2.5 kg Tomatoes priced Rs.10.0 per kg. He gives the currency of
Rs.500 to the shopkeeper. Find out the amount shopkeeper will return to Krishna.
Inputs to the algorithm are:
1. amount of different items purchase, for example 2.0 kg Apple etc.
2. price of the items, for example Mango is Rs. 35.0 per kg
3. total amount given to the shopkeeper
Expected output:
Amount to be returned by shopkeeper after deducting total price of the purchased
vegetables and fruits, and total items purchased.
2. The below given flowchart is used to find whether a number X is even or odd. What will be
content in the decision box? Write an algorithm for the same.

1
Mukesh Patel School of Technology Management & Engineering, SVKM’s NMIMS University
COURSE: Programming for Problem Solving

3. Obtain the user’s choice to find area of given shape (Rectangle, Circle and Triangle).
Calculate and output the area of the shape chosen. List the variables required and draw the
flowchart (using the same names as your variable list). Also perform a dry run using input of
6 for the circle.
4. Obtain a temperature in degrees celsius from the user. If the temperature is 35 degrees or less
display the message "Go play Cricket" otherwise, if the temperature is between 36 to 55
degrees display the message "Go for indoor games", display the message "It is chilling" if the
temperature is less than 5 degrees and “It is very hot” if the temperature is above 55 degrees.

2
Mukesh Patel School of Technology Management & Engineering, SVKM’s NMIMS University
COURSE: Programming for Problem Solving
Theory:

Algorithm:
Defined as: “A sequence of activities to be processed for getting desired output from a given input.”

+ Addition

- Subtraction

* Multiplication

/ Division

ß Assignment. For example B ß Y*7 means B will


have the value of Y*7

Read For taking input

Print For displaying output

Start For beginning the algorithm steps

End For stopping the algorithm steps to make it a finite


algorithm

if <condition> then <statement> For conditional statement


else <statement>

Go to step n For moving to step n

Example:
Algorithm to add two numbers entered by the user.
Step 1: Start
Step 2: Declare the variables Num1, Num2 and Sum
Step 3: Read values Num1 and Num2
Step 4: Add Num1 and Num2 and assign the result to Sum
Sum = Num1+ Num2
Step 5: Display Sum
Step 6: Stop

3
Mukesh Patel School of Technology Management & Engineering, SVKM’s NMIMS University
COURSE: Programming for Problem Solving
Flowchart:

Defined as a diagram which visually presents the flow of data through processing systems. Flowchart
can be used for representing an algorithm. It describes the operations (and in what sequence) are
required to solve a given problem.

Sr.No Shape Description

1 Terminal: To represent the start and end of algorithms

2 Input/Output: To represent the input and output or the read


and write operations of algorithms.

3 Processing: To represent the processing of instructions like


arithmetic operation and data manipulators.

4 Decision: To represent branching of the statements. To take


decisions. There will be one entry point and more than one
exit point.

5 Flow Line: To represent flow of data or the sequence of


statements.

6 On-page Connector: Used to join different flowline

7 Off-page Connector: Used to connect flowchart portion on


different page.

8 Predefined Process/Function: Used to represent a group of


statements performing one processing task.

4
Mukesh Patel School of Technology Management & Engineering, SVKM’s NMIMS University
COURSE: Programming for Problem Solving

Experiment: 1
(PART B: TO BE COMPLETED BY STUDENTS)

Students must submit the soft copy as per following segments within two hours of the practical. The
soft copy must be uploaded on the portal at the end of the practical. The filename should be
RollNo_Batch_ExperimentNo_OOP Example: B001_B1_Exp1_OOP

Roll No.: Name:

Program/Year/SEM: Bti Batch:

Date of Experiment: Date of Submission:

Task 1: Algorithm and Flowchart

1. ALGORITHM:
Step 1: Start

Step 2: Initialize Variable amount to 500, milk_rate to 50, carrot_rate to 35, tom_rate

to 10, milk_qty to 2, carrot_qty to 1.5 and tom_qty to 2.5

amount = 500

milk_rate = 50

carrot_rate = 35

tom_rate = 10

milk_qty = 2

carrot_qty = 1.5

tom_qty = 2.5

Step 3: Calculate amount to be returned by the shopkeeper and assign it to variable amount

amount = amount – [(milk_qty*milk_rate) + (carrot_qty*carrot_rate) +

(tom_qty*tom_rate)]

Step 4: Display Amount

Step 5: Stop.

2.

5
Mukesh Patel School of Technology Management & Engineering, SVKM’s NMIMS University
COURSE: Programming for Problem Solving
Conclusion (Learning Outcomes): Reflect on the questions answered by you jot down your
learnings about the Topic: Algorithm and Flowchart.

Homework Questions:

1. Write an algorithm and draw a flowchart that will obtain from the user a length and width for
a rectangle. Calculate and output the area and perimeter of the rectangle. Perform a dry run
using inputs of 6 and 12 for the rectangle.

2. Draw a flowchart to match the following pseudocode:


Step1: Assign variable n1 a starting value of 6
Step2: Assign variable n2 a starting value of 8
Step3: Add 9 to n2
Step4: Store the value n1 times n2 in variable n3
Step5: Store the value n2 minus n1 in n2
Step6: Display n1, n2 and n3

3. Write an algorithm and draw flow chart to read the marks of students and classify them into
different grades. If the marks secured are greater than or equal to 90, the student is awarded
grade A; but if they are greater than or equal to 80 but less than 90, Grade B is awarded; if
they are greater than or equal to 65 but less than 80, Grade C is awarded; otherwise Grade D
is awarded.

You might also like