Download //WRITE AN ALGORITHM TO FIND THE SUM OF TWO NUMBERS

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
//WRITE AN ALGORITHM TO FIND THE
SUM OF TWO NUMBERS.
STEP 1 : START
STEP 2 : ACCEPT FIRST NUMBER
STEP 3 : ACCEPT SECOND NUMBER
STEP 4 : ADD THESE TWO NUMBERS
STEP 5 : DISPLAY RESULT
STEP 6 : STOP
Write an algorithm to find the largest
among three different numbers entered by
user.
Step 1: Start
Step 2: Declare variables a,b and c.
Step 4: If a>b
If a>c
//WRITE AN ALGORITHM TO FIND THE
SUM OF THREE NUMBERS.
STEP 1 : START
STEP 2 : ACCEPT ALL THREE NUMBERS
STEP 3 : ADD ALL THREE NUMBERS AND
STORE IN ONE VARIABLE
STEP 4 : DISPLAY THE RESULT
STEP 5 : STOP
//WRITE AN ALGORITHM TO FIND THE
AREA OF RECTANGLE.
Display a is the largest
Else
Display c is the largest
Else
If b>c
Display b is the largest
Else
STEP 1 : START
STEP 2 : ACCEPT THE W OF RECTANGLE
STEP 3 : ACCEPT THE H OF RECTANGLE
STEP 4 : Area = w × h
Display c greatest
Step 5: Stop
STEP 5 : DISPLAY
OR
STEP 6 : STOP
Step 1: Start
Circle
Area = π × r2
Circumference = 2 × π × r
Triangle
Area = ½ × b × h
b = base
h = vertical height
Sector
Area = ½ × r2 × θ
r = radius
θ = angle in radians
Step 2: Declare variables a,b and c.
Step 4: If a>b && a>c then goto step 7
othervise goto step 5
Step 5: if b>a && b>c then goto step 8
othervise goto step 6
Step 6: print c is greater goto step9
Step 7: print a is gresater goto step9
Step 8: print b is greater goto step9
Step 9: stop
Related documents