02 Algorithm
02 Algorithm
Pseudocode
• Refine the algorithm successively to get step by step detailed algorithm that is very
close to a computer language.
Pseudocode:
• Input a set of 3 numbers
• Print Sum
ALGORITHMS
– Implementation phase
• implement the program in some programming language
Role of Algorithms
Hardware
Software
Programming
Program
Algorithm
Algorithm:
Step 1: Input N1,N2,N3
Step 2: Sum=N1+N2+N3
Step 3: Print Sum
Algorithm (Example No 2)
Algorithm:
Algorithm:
Step 1: Input Num1,Num2,Num3
Step 2: Sum=Num1+Num2+Num3
Step 3: Average=(Num1+Num2+Num3)/3
Step 4: Print Sum
Step 5: Print Average
Pseudocode
Pseudocode:
• if average is below 50
Print “FAIL”
else
Print “PASS”
Algorithm
Algorithm:
Algorithm:
Step 1: Input Current year , Birth year
Step 2: res = Current year – Birth Year
Step 3: If (res > 18)
Print “eligible “
else
Print “Not eligible “