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

Algorithm and Flow Chart: First Year B.Tech

The document contains 6 algorithms and flowcharts to: 1. Find the addition of two numbers. 2. Find the average marks of 5 subjects. 3. Find the area of a circle, rectangle, and triangle. 4. Compare two unequal numbers and print the greater. 5. Determine if a given number is even or odd. 6. Calculate the sum of numbers from 1 to 100.

Uploaded by

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

Algorithm and Flow Chart: First Year B.Tech

The document contains 6 algorithms and flowcharts to: 1. Find the addition of two numbers. 2. Find the average marks of 5 subjects. 3. Find the area of a circle, rectangle, and triangle. 4. Compare two unequal numbers and print the greater. 5. Determine if a given number is even or odd. 6. Calculate the sum of numbers from 1 to 100.

Uploaded by

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

First Year B.

Tech 2021

Algorithm and Flow Chart

Exercise 1: Write an Algorithm and Draw Flow Chart to Find the Addition of

Two Numbers

START

Step 1: Take Two Integer START


Variables, Say A and B

Step 2: Assign Value to that


Input: A, B
variable

Step 3: Perform the Operation


(A+B) and Store the Result in a C=A+B
Variable C

C=A+B;

Step 4: Display Result (Print: C) Print : C

STOP
STOP

Computer Program in C Page 1


First Year B.Tech 2021

Exercise 2: Write an Algorithm and Draw Flow Chart to Find Average marks

Of 5 subjects in FYBtech (Subjects are: CPC,BME,EM,PC,EC)

START

Step 1: Take Five subject START

CPC,BME,EM,PC,EC as a Integer

Variables
Input: CPC, BME,
Step 2: Assign Value to that variables EM, PC, EC

Step 3: Compute

a. Total =CPC+BME+EM+PC+EC; Total=CPC+BME+EM+EC+PC


b. Avg=Total/5; Avg=Total/5
Step 4: Display Result (Print: Avg)

STOP
Print: Avg

STOP

Computer Program in C Page 2


First Year B.Tech 2021

Exercise 3: Write an Algorithm and Draw Flow Chart to Find Area Circle,

Rectangle and Triangle

3.1 (Area of Circle)

START

Step 1: Take floating point variable START

radius and Pi as a input

Step 2: Assign Value to varibles


Input: radius,Pi
Step 3: Calculate Area of circle

Area=pi*radius*radius;

Step 4: Display Result (Print: Area) Area=pi*radius*radius

STOP

Print: Area

STOP

Computer Program in C Page 3


First Year B.Tech 2021

3.2 (Area of Rectangle)

START

Step 1: Take floating point variables START

length and width as input

Step 2: Assign Value to variables Input: length, width

Step 3: Calculate Area of Rectangle

Area=length*width; Area=length*width

Step 4: Display Result (Print: Area)

STOP
Print: Area

STOP

Computer Program in C Page 4


First Year B.Tech 2021

3.3 (Area of Triangle)

START

Step 1: Take floating point variables START

height and width as a input

Step 2: Assign Value to variables


Input: height, base
Step 3: Calculate Area of Triangle

Area=0.5*height*base;
Area=0.5*height*base
Step 4: Display Result (Print: Area)

STOP

Print: Area

STOP

Computer Program in C Page 5


First Year B.Tech 2021

Exercise 4: Write an Algorithm and Draw Flow Chart to compare two

Unequal number and print greater

START START

Step 1: Take Two Integer Variables, Say A & B

Step 2: Assign Value to variables Input: A,B


Step 3: Compare variable A is greater than B

(A>B)

Step 4: If True: Print: A is greater than B) True False


Is A>B ?
Step 5: If False: Print: B is greater than A)

STOP

Print: A Print: B

STOP

Computer Program in C Page 6


First Year B.Tech 2021

Exercise 5: Write an Algorithm and Draw Flow Chart to find given number is

Even or odd

START

Step 1: Take Two Integer Variable A


START
Step 2: Assign Value to variable A

Step 3: Perform A Modulo 2 (A%2) and check

Reminder if it is Zero Input: A

Step 4: If True: (Print: A is Even)

Step 5: If False :( Print: A is Odd)


True False
STOP A%2==0

Print : A Even Print : A Odd

STOP

Computer Program in C Page 7


First Year B.Tech 2021

Exercise 6: Write an Algorithm and Draw Flow Chart to calculate the sum of

1, 2, 3……….100 numbers

START

Step 1: Define sum=0


START
Step 2: Define counter=1

Step 3: while counter<=100 do the following


sum=0
a. sum=sum+ counter
counter=1
b. counter=counter+1

Step 4: Print: sum


False
STOP counter
<=100

True

sum=sum + counter

counter=counter+1

Print: sum

STOP

Computer Program in C Page 8

You might also like