MENU

Chapter 6 Algorithms and Flowcharts Solutions

Question - 21 : -
Write an algorithm for calculating the conversion from rupees to dollars.

Answer - 21 : -

Algorithm is defined as follows :

Step 1: Start.
Step 2: Read the amount in rupees and conversion rate.
Step 3: Calculate the equivalent amount in dollars using the following formula : amount in dollars = amount in rupees / conversion rate.
Step 4 : Write the amount in dollars.
Step 5 : Stop.

Question - 22 : -
Write an algorithm to find the largest among three numbers.

Answer - 22 : -

The algorithm is defined as :

Step 1: Read X, Y, Z.
Step 2 : If X > Y continue step 5.
Step 3 : If Y>Z then print “Y is the largest “and continue step 7.
Step 4 : Continue step 6.
Step 5 : If X>Z then print “X is the largest “and continue step 7.
Step 6 : Print “Z is largest”.
Step 7: End.

Question - 23 : -
Write an algorithm to input N numbers and find the largest among them.

Answer - 23 : -

The algorithm as :

Step 1 : Read N.
Step 2 : Let ctr = 1.
Step 3 : Read Num.
Step 4 : large = Num.
Step 5 : Read next Num.
Step 6 : ctr = ctr + 1.
Step 7 : If (Num > large) then large = Num.
Step 8 : If (ctr < = N) then repeat steps 5 and 6.
Step 9 : Print large.
Step 10 : End.

Question - 24 : -
Write an algorithm to compute the sum of odd and even numbers up to N.

Answer - 24 : -

The algorithm as :

Step 1: Start.
Step 2 : Input N.
Step 3 : sume = 0.
Step 4 : sumo = 0.
Step 5 : ctr = 1.
Step 6 : while (ctr < = N).
If (ctr mod 2 = 0)
sume = sume + ctr
else
sumo = sumo + ctr.
Step 7: Print “sum of even number is” sume.
Step 8 : Print “sum of odd number is” sumo.
Step 9: End.

Question - 25 : -
Draw a flowchart to calculate sum of two numbers

Answer - 25 : -

Question - 26 : -
Draw the flowchart to print the largest of any three numbers.

Answer - 26 : -


Question - 27 : -
Draw the flowchart to print sum of first 100 natural numbers.

Answer - 27 : -


Free - Previous Years Question Papers
Any questions? Ask us!
×