ADS

Tuesday, 8 May 2018

Algorithm Example: How to create algorithm




Q-1 Write an algorithm to find the average of given Number.


    1.       Start
    2.       Let the input variable are A, B, C, D, E and output variable avg.
    3.       Input the value of A,B,C,D,E
    4.       avg=(A+B+C+D+E) / 5
    5.       output the value of avg
    6.       Stop


 Q-2 Write an algorithm to calculate area and perimeter of circle

    1.       Start
    2.       Let the input variable is r and output variables are A and P.
    3.       Input the value of r.
   4.       A=pi * r2
   5.       P = 2 * Pi * r
   6 .       Output variable (A&P) the value of A & P
   7.       Stop

Q-3 Write an algorithm to find simple interest.

    1.       Start
    2.       Let input variable are p, r & t and output variable is s.
    3.       Input the value of p, r & t.
    4.       S= (p * r * t) /100
    5.       Output the value of s
    6.       Stop



Q-4 Write an algorithm to find area of triangle using Hero’s formula.

    1.       Start
    2.       Input variables are a, b, c and output variable is A.
    3.       Input the value of a, b, c
    4.       S=( a + b + c ) /2
    5.       A=sqrt (s ( sa ) * ( sb ) * ( sc ) )
    6.       Output the value of A
    7.       Stop















No comments:

Post a Comment

Popular Posts