Professional Documents
Culture Documents
Or
E S . I N
input: An algorithm has zero or more inputs, taken from a
KTU NOT
specified set of objects.
output: An algorithm has one or more outputs, which have a
specified relation to the inputs.
effectiveness: All operations to be performed must be sufficiently
basic that they can be done exactly and in finite length
Expressing Algorithms
STEP 1 : START
STEP 2 : READ FIRST NUMBER
STEP 3 : READ SECOND NUMBER
STEP 4 : ADD THESE TWO NUMBERS
STEP 5 : DISPLAY RESULT
STEP 6 : STOP
S . I N
WRITE AN ALGORITHM TO FIND THE AREA OF RECTANGLE.
E
KTU
STEP 1 : START NOT
STEP 2 : READTHE length OF RECTANGLE
STEP 3 : ACCEPT THE breadth OF RECTANGLE
STEP 4 : Area = length x breadth
STEP 5 : DISPLAY Area
STEP 6 : STOP
STEP 1 : START
STEP 2 : READTHE radius OF CIRCLE
STEP 3 : Area = π × r x r
STEP 4 : DISPLAY Area
STEP 5 : STOP
Used for any Input / Output (I/O) operation. Indicates that the
Input/ output :
computer is to obtain data or output results
E S . I N
KTU NOT
Flow lines: Shows direction of flow
S . I N
OTE
Display a is the largest number.
Else
Else
K T U N
Display c is the largest number.
If b>c
Display b is the largest number.
Else
Display c is the greatest number.
Step 5: Stop
S . I N
OTE
Step 6: Display factorial
Step 7: Stop
K T U N
Write an algorithm to check whether a number entered by user is prime or
not.
Step 1: Start
Step 2: Declare variables n ,i, flag.
Step 3: Initialize variables
Flag 0
i 2
Step 4: Read n from user.
Step 5: Repeat the steps until i <(n/2)
5.1 If remainder of n÷i equals 0
Flag 1
Go to step 6
5.2 I i+1
Step 6: If flag=1
Display n is not prime
S . I N
T U N OTE
K