Algorithm and Flowcharts Sums
Algorithm and Flowcharts Sums
zero.
ALGORITHM
Step 1: Start
Step 2: Take any number and store it in X.
Step 3: Check n value, if X < 0 then go to step 5 else go to step 4
Step 4: Check n value, if X > 0 then go to step 6 else go to step 7
Step 5: Print “Given number is -ve” and go to step 8
Step 6: Print “Given number is +ve” and go to step 8
Step 7: Print “Given number is zero” Step 8: Stop
FLOWCHART START
Input Number X
NO
NO
IF X > 0
YES
STOP
2) Write an algorithm and draw a flowchart to find the sum of two numbers
ALGORITHM
Step-1 Start
Step-2 Input first number A
Step-3 Input second number B
Step-4 SUM = A + B
Step-5 Display SUM
Step-6 Stop
FLOWCHART
START
INPUT A
INPUT B
SUM = A + B
PRINT SUM
STOP
3) Write an algorithm and draw a flowchart to convert temperature from Celsius to
Fahrenheit
C: temperature in Celsius
F: temperature Fahrenheit
ALGORITHM
Step-1 Start
Step-2 Input temperature in Celsius say C
FLOWCHART
START
INPUT C
F=(C * 9/5) + 32
PRINT F
STOP
4) Write an algorithm and draw a flowchart to find Area and Perimeter of Square
L: Side Length of Square
AREA: Area of Square
PERIMETER: Perimeter of Square
ALGORITHM
Step-1 Start
Step-2 Input Side Length of Square L
Step-3 Area = L x L
Step-4 PERIMETER = 4 x L
Step-5 Display AREA, PERIMETER
Step-6 Stop
FLOWCHART
START
INPUT L
AREA = L * L
PERIMETER = 4 * L
STOP
5) Write an algorithm and draw a flowchart to find Area and Perimeter of Rectangle
L: Length of Rectangle
B: Breadth of Rectangle
AREA: Area of Rectangle
PERIMETER: Perimeter of Rectangle
Algorithm
Step-1 Start
Step-2 Input Side Length & Breadth say L, B
Step-3 Area = L * B
Step-4 PERIMETER = 2 * (L + B)
Step-5 Display AREA, PERIMETER
Step-6 Stop
FLOWCHART
START
INPUT L, B
AREA = L * L
PERIMETER = 2 * ( L + B)
STOP
6) Write an algorithm and draw a flowchart to find Square of a Number
N: Number
S: Square
Algorithm
Step-1 Start
Step-2 Input N
Step-3 Square = N * N
Step-5 Display SQUARE
Step-6 Stop
FLOWCHART
START
INPUT N
SQUARE = N * N
PRINT SQUARE
STOP
7) Write an algorithm and draw a flowchart to find Cube of a Number
N: Number
S: Square
Algorithm
Step-1 Start
Step-2 Input N
Step-3 Cube = N * N * N
Step-4 Display Cube
Step-5 Stop
FLOWCHART
START
INPUT N
CUBE = N * N * N
PRINT CUBE
STOP
8) Write an algorithm and draw a flowchart to determine the largest number among all the
entered integers
A: Number 1
B: Number 2
Algorithm
Step 1: Start
Step 2: Input Integer A.
Step 3: Input Integer B.
Step 4: If B is greater than A, then
Step 5: Print B,
Else A.
Step 5: Stop
FLOWCHART
START
INPUT A, B
NO
IS B > A PRINT A
YES
PRINT B
STOP
9) Write an algorithm and draw a flowchart to determine the Highest Common Factor
(HCF) of two integers
A: Number 1
B: Number 2
Algorithm
Step 1: Start
Step 2: Input Integer A.
Step 3: Input Integer B.
Step 4: If a = b, go to step 6.
Step 5: If a > b, then: a = a - b. Return to step 4.
Step 6: Print A or B.
FLOWCHART
START
INPUT A , B
YES
IS A=B?
PRINT
NO
STOP
YES NO
IS A>B?
A=A-B B=B-A
10) Write an algorithm and draw a flowchart to calculate the Interest of a Bank Deposit
A: Amount
Y: Years
R: Rate of Interest
I: Interest
Algorithm
Step 1: Start
Step 2: Input amount.
Step 3: Input years.
Step 4: Input rate.
Step 5: Calculate the interest with the formula "Interest=Amount*Years*Rate/100.
Step 6: Print interest.
Step 7: Stop
START
FLOWCHART
INPUT A
INPUT Y
INPUT R
I = A * R * Y / 100
PRINT I
STOP