0% found this document useful (0 votes)
71 views2 pages

Algorithm PDF

This document contains algorithms to find: 1) The largest of three numbers by comparing each number and displaying the largest 2) The sum of two numbers by accepting the numbers, adding them, and displaying the result 3) The area of a rectangle by accepting the width and height, multiplying them, and displaying the area It also provides formulas for calculating the area of circles, triangles, and sectors.

Uploaded by

James Brian
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)
71 views2 pages

Algorithm PDF

This document contains algorithms to find: 1) The largest of three numbers by comparing each number and displaying the largest 2) The sum of two numbers by accepting the numbers, adding them, and displaying the result 3) The area of a rectangle by accepting the width and height, multiplying them, and displaying the area It also provides formulas for calculating the area of circles, triangles, and sectors.

Uploaded by

James Brian
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/ 2

//WRITE AN ALGORITHM TO FIND THE Write an algorithm to find the largest

SUM OF TWO NUMBERS. among three different numbers entered by


user.
STEP 1 : START
Step 1: Start
STEP 2 : ACCEPT FIRST NUMBER
STEP 3 : ACCEPT SECOND NUMBER Step 2: Declare variables a,b and c.
STEP 4 : ADD THESE TWO NUMBERS
STEP 5 : DISPLAY RESULT Step 4: If a>b
STEP 6 : STOP
If a>c
//WRITE AN ALGORITHM TO FIND THE
SUM OF THREE NUMBERS. Display a is the largest

Else
STEP 1 : START
STEP 2 : ACCEPT ALL THREE NUMBERS
Display c is the largest
STEP 3 : ADD ALL THREE NUMBERS AND
STORE IN ONE VARIABLE Else
STEP 4 : DISPLAY THE RESULT
STEP 5 : STOP If b>c

//WRITE AN ALGORITHM TO FIND THE Display b is the largest


AREA OF RECTANGLE.
Else
STEP 1 : START
Display c greatest
STEP 2 : ACCEPT THE W OF RECTANGLE
STEP 3 : ACCEPT THE H OF RECTANGLE Step 5: Stop
STEP 4 : Area = w × h

STEP 5 : DISPLAY

STEP 6 : STOP
OR
Step 1: Start
Circle
Area = π × r2 Step 2: Declare variables a,b and c.
Circumference = 2 × π × r
Step 4: If a>b && a>c then goto step 7
Triangle othervise goto step 5
Area = ½ × b × h
b = base Step 5: if b>a && b>c then goto step 8
h = vertical height othervise goto step 6

Sector Step 6: print c is greater goto step9


Area = ½ × r2 × θ
r = radius Step 7: print a is gresater goto step9
θ = angle in radians
Step 8: print b is greater goto step9

Step 9: stop

You might also like