7 Unit 3 2024
7 Unit 3 2024
▪ Well-defined outputs
▪ Finite-ness
▪ Feasible
▪ Language independence
Sorting algorithm:
This algorithm helps us in arranging a group of data in a particular manner.
Disadvantages of flowchart:
1. Difficult to present complex problems.
2. Modification is difficult.
3. Time consuming.
2
1: START.
2: Declare three variables suppose a, b, c.
3: Read the three numbers to be added as input in variables a, b, c.
4: Declared a variable sum to store the sum of three numbers.
5: Add the three numbers and store the result in variable sum as sum=a+b+c.
6: Print the value of the variable sum.
7: END.
3. Write the algorithm to find whether the given umber is even or odd.
Answer:
Algorithm to find whether the given umber is even or odd:
1: START.
2: Declare a variable n1.
3: Read the number to be checked as input in variable n1.
4: Declare a variable remainder to store the resultant remainder by 2 of the
number.
5: Remainder = n1%2.
6: Check IF remainder = 0, then print “Even Number” otherwise print “Odd
Number”.
7: END.
Start
INPUT number A
Rem=A%2
No Yes
Rem=0
Stop
8. How can we measure the efficiency of a solution.
Answer:
Measuring the efficiency of a solution:
5
Page