0% found this document useful (0 votes)
16 views

Exp 1

Hdidb

Uploaded by

priyanshamesara
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)
16 views

Exp 1

Hdidb

Uploaded by

priyanshamesara
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/ 5

SVKM’s NMIMS

Mukesh Patel School of Technology Management & Engineering /


School of Technology Management & Engineering

B. Tech/MBA Tech Lab and Workbook Academic Year- 2024-25

Year:-First Subject:- Programming for Problem Solving Semester: - First

Experiment: 1
PART A

(PART A: TO BE REFERRED BY STUDENTS)

Aim: Writing algorithms and designing flow charts

Learning Outcomes: The learner would be able to

1. Explain what an algorithm and a flowchart is


2. Identify basic shapes in a flowchart
3. Map an algorithm to a flowchart
4. Analyze the scenario to write an algorithm and draw a flowchart (breaking the
problem into steps of selection, sequence and repetition).
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


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

B. Tech/MBA Tech Lab and Workbook Academic Year- 2024-25

Year:-First Subject:- Programming for Problem Solving Semester: - First

algorithm

if <condition> then <statement> For conditional statement


else <statement>

Go to step n For moving to step n

Repeat For repeating a set of statements/instructions

Flowchart:

Defined as a diagram which visually presents the flow of data through processing systems.
Flowcharts 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


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

B. Tech/MBA Tech Lab and Workbook Academic Year- 2024-25

Year:-First Subject:- Programming for Problem Solving Semester: - First

7 Off-page Connector: Used to connect flowchart


portion on different page.
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering /
School of Technology Management & Engineering

B. Tech/MBA Tech Lab and Workbook Academic Year- 2024-25

Year:-First Subject:- Programming for Problem Solving Semester: - First

Tasks:

1. Write an algorithm and draw a flowchart to calculate simple interest.


2. Write an algorithm and draw a flowchart that will obtain the length and width of a
rectangle from the user. Calculate and display the area and perimeter of the
rectangle.
3. Krishna goes to the market for buying milk and vegetables. He is having a currency
of Rs.500 with him. From a shop, he purchases 2.0 litres of Milk priced at Rs.50.0
per litre, 1.5 kg of Carrots priced at Rs.35.0 per kg, and 2.5 kg of Tomatoes priced
at Rs.10.0 per kg. He gives the currency of Rs.500 to the shopkeeper. Write an
algorithm and draw a flowchart to calculate and display the amount the shopkeeper
will return to Krishna.
4. Draw a flowchart to match the following algorithm:
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

5. Write an algorithm and draw a flow chart to check whether a number is even or
odd.

6. Write an algorithm and draw a flow chart to read a student's percentage marks,
classify it into different grades, and display the grade. If the percentage 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.
7. Write an algorithm and draw a flow chart to input the lengths of three sides of a
triangle and check whether the triangle is valid or not. Also, classify the triangle as
equilateral, isosceles or scalene.
Note: If the sum of the lengths of any two sides is greater than the length of the
third side then a triangle is valid.
Equilateral triangle: if all sides are equal.
Isosceles triangle: if any two sides are equal.
Scalene triangle: if the above two condition fails.
8. Write an algorithm and draw a flow chart to find the factorial of a number.
SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering /
School of Technology Management & Engineering

B. Tech/MBA Tech Lab and Workbook Academic Year- 2024-25

Year:-First Subject:- Programming for Problem Solving Semester: - First

9. Write an algorithm and draw a flow chart to find the sum of the following series- 12
+ 22 + 32 +…. N2

PART B

(PART B: TO BE COMPLETED BY STUDENTS)

Students must solve experiment-1 in workbook and submit the evaluated signed soft copy.
The soft copy must be uploaded on the portal. The filename should be
PPS_batch_rollno_experimentno Example: PPS_A1_A001_P1

Roll No.: Name:

Prog/Yr/Sem: Batch:

Date of Experiment: Date of Submission:

Tasks:

1.

2.

3.

You might also like