Page 451 - Cs_withBlue_J_C11_Flipbook
P. 451

2.  Write the purpose of the following symbols in the flowchart.
                       a.

                       b.

                       c.

                       d.

                       e.

                    3.  Write one similarity and one difference between pseudocode and flowchart.
                    4.  With your friends, cook a dish for your teacher. Discuss the recipe with your teacher in the class.
                    5.  Define the following:
                       a.  Best case
                       b.  Worst case
                       c.  Average case complexity
                    6.  Write an algorithm to accept the cost price and selling price of an item. Check whether it is profit or loss. Then, print the profit or
                       loss amount along with the profit or loss percentage.
                    7.  Write an algorithm to find the smallest among three numbers.
                    8.  Write an algorithm to accept any number and print whether it is a positive number, negative number or zero.
                    9.  Write an algorithm to accept three angles of a triangle. Check if the triangle is possible or not and predict whether it is an acute-
                       angled, obtuse-angled or right-angled triangle.
                       Properties of a triangle are given below.
                       a.  Sum of three angles of a triangle is 180°.
                       b.  In acute angled triangle, all the three angles are less than 90°.
                       c.  In right angled triangle, one angle is 90°.
                       d.  In obtuse angled triangle, one angle is greater than 90°.
                   10.  Write an algorithm to accept three sides of a triangle. Check if the triangle is possible or not and predict it is an equilateral,
                       isosceles or scalene triangle. Properties of a triangle are given below.
                       a.  In a triangle, any side is less than the sum of the other two sides.
                       b.  In an equilateral triangle, all sides are equal.
                       c.  In an isosceles triangle, any two sides are equal.
                       d.  In a scalene triangle, all three sides are unequal.
                   11.  Write an algorithm to accept an integer decimal number and perform the following conversion:
                       a.  Convert it to Binary
                       b.  Convert it to Octal
                       c.  Convert it to Hexadecimal
                       For reference, check Chapter 1 Number System of this book.
                   12.  Write an algorithm to enter the number of terms ‘n’ and print the numbers of a Pell Series. Pell Series is a series in which each
                       term is the sum of the twice of the previous number and the number previous to that. The first and the second term of the series
                       are 1 and 2.
                       The first 5 terms of a Pell Series are 1, 2, 5, 12, 29.
                        If we express it as a mathematical equation then,
                        rd
                        3  term = 1 + 2*2 = 5
                        th
                        4  term = 2 + 5*2 = 12, and so on.
                   13.  Write an algorithm to accept any number and print if it is a deficient number or not. The deficient number can be defined as the
                       number for which the sum of the proper divisors excluding itself, is lesser than the number.
                       A few examples are as follows:
                       All prime numbers are deficient numbers because they have two factors 1 and the number. Sum of its factor is 1 which is less than
                       the number.
                       14 is a deficient number as the factors 1, 2, 7. On adding, gives 10, which is less than 14.




                                                                                                                       449
                                                                            Implementation of Algorithms to Solve Problems  449
   446   447   448   449   450   451   452   453   454   455   456