2 MARKS - Unit I
2 MARKS - Unit I
1.What is an algorithm?
An algorithm is a finite number of clearly described, unambiguous do able steps that
can be systematically followed to produce a desired result for given input in the given
amount of time. In other word, an algorithm is a step by step procedure to solve a problem
with finite number of steps.
6.Write an algorithm to accept two numbers, compute the sum and print the result.
Step 1: Start
Step 2: Read num1, num2
Step 3: Sum = num1+num2
Step 4: Display sum
Step 5: Stop
7. What are the Guidelines for writing pseudo code?
Write one statement per line
Capitalize initial keyword
Indent to hierarchy
End multiline structure
Keep statements language independent.
8.Differentiate between iteration and recursion.
11.Draw a flow chart to find whether the given year is leap year or not
Start
Read year
If
(year%4==0)
Stop