Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Experiment No.

02

PART A

(PART A: TO BE REFFERED BY STUDENTS)

A.1 Aim:To study Algorithm and Flow charts.


Task1: Write an algorithm and draw flow chart to
1. SUM = 12 + 22 + 32 +…. N2
2. Perform mathematical operations like addition, multiplication, division and subtraction
based on user’s choice.
3. Print numbers from 10 to 01.
4. To accept N numbers and find their average
5. To find whether a given number is prime or not

Task 2: The following incomplete flowchart add all even numbers between 1 to 50.

Complete it by joining X with the given option


PART B

(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 Blackboard or emailed to the
concerned lab in charge faculties at the end of the practical in case the there is no
Black board access available)

Roll No.: F010 Name: Neel Gupta


Program: B.Tech Mechanical Division: F
Semester: II Batch : F1
Date of Experiment: Date of Submission:
Grade :

B.1 Algorithm

1. Step 1: Start.

Step 2: Input n.

Step 3: a: count=1

b: sum=0

Step 4:a: while (count<=n)

b: sum=(count*count) + sum.

c: count=count+1.

Step 5: Repeat Step 4.

Step 6: Stop.

2. ADDITION.

Step 1: Start.

Step 2: Input 2 numbers x and y.

Step 3: z=x+y//store the result in z.


Step 4: Display z.

Step 5: Stop.

SUBTRACTION.

Step 1: Start.

Step 2: Input 2 numbers x and y.

Step 3: z=y-x//store the result in z.

Step 4: Display z.

Step 5: Stop.

MULTIPLICATION.

Step 1: Start.

Step 2: Input 2 numbers x and y.

Step 3: z=x*y//store the result in z.

Step 4: Display z.

Step 5: Stop.

DIVISION.

Step 1: Start.

Step 2: Input 2 numbers x and y.

Step 3: Divide the 2 numbers and store the result in z.


Step 4: Display z.

Step 5: Stop.

3.

Step 1: Start.

Step 2: count=10

Step 3: a: print count.

b: while (count>=1)

c: count=count-1.

Step 4: Repeat step 3.

Step 5: Stop.

4.

Step 1: Start.

Step 2: Input n.

Step 3: a: count=1

b: sum=0

Step 4: a: while (count<=n)

b: Input num.

c: sum=sum+num

d: count=count+1

Step 5: Average=sum/n
Step 6: Print average.

Step 7: Stop.

B.2 Flow Chart

1.

2. Start

ADDITION
Input x and y

x+y=z

Display z

Stop

Start
SUBTRACTION

Input x and y

y-x=z

Start
Display z
MULTIPLICATION
Input x and y
Stop

x*y=z
Input x and y

Stop

DIVISION
Start

Input x and y

y/x=z

Input x and y

3. Stop
4.

B.3 Conclusion:
(Students must write the conclusion as per the attainment of individual outcome listed above and
learning/observation)

B.4 Question of Curiosity:

You might also like