Wednesday 9 December 2015

LBEPS Lab@Home 2

1.Write an algorithm for accepting two numbers, divide the first number by the second, and display their quotient. (Duration: 10 Minutes)

Ans  Step1 :- Start the algorithm.
Step2 :- Let A,B and C the variables.
step3 :- accept first number from user.
step4 :- accept second number from user.
Step5 :- c=A/B.
Step6 :- Display C.
Step7 :- end the algorithm.


2.Write an algorithm that accepts a distance in kilometers, converts the same into meters, and then displays the result. (Duration: 10 Minutes).


Ans
     Step1 :- Start the algorithm.
Step2 :- Let A,B the variables.
step3 :- Display "Enter the distance in kilometers".
step4 :- accept the distance entered by the user.
Step5 :- B= a*1000.
Step6 :- Display B.
Step7 :- end the algorithm.


3.Write an algorithm that accepts a letter from the alphabet and determines whether it is a vowel or a consonant. (Duration: 5 Minutes)


Ans
        Step1 :- Start the algorithm.
Step2 :- Let A as character variables.
step3 :- Display "Enter the alphabet".
step4 :- if A== A,E,I,O,U,a,e,i,o,u.
Step5 :- Display "It is a vowel".
Step6 :- Else Display " It is a consonant".
Step7 :- end the algorithm.





4.Write an algorithm that accepts the distance and speed values for a particular journey, calculates the time taken for the journey, and displays it. (Duration: 10 Minutes)


Ans  Step1 :- Start the algorithm.
Step2 :- Let A,B and C variables.
step3 :- Display "Enter the Distance".
step4 :- Accept the distance entered.
Step5 :- Display "Enter the speed".
step6 :- Accept the speed entered.
Step7 :- C=A/B.
Step8 :- Display C.
Step9 :- end the algorithm.


5.Write an algorithm that accepts five numbers and displays the sum and average of the numbers. (Duration: 10 Minutes)


Ans   Step1  :- Start the algorithm.
Step2  :- Let A,B,C,D,E,F,G variables.
step3  :- Display "Enter the numbers".
step4  :- Accept Num1.
step5  :- Accept Num2.
step6  :- Accept Num3.
step7  :- Accept Num4.
step8  :- Accept Num5.
step9  :- F=A+B+C+D+E.
step10 :- G= F/5.
Step11 :- Display "Sum =", F.
Step12 :- Display "Average =", G.
Step13 :- end the algorithm.


6.Write an algorithm that accepts the length of the side of a square and displays its area. (Duration: 10 Minutes)


Ans     Step1  :- Start the algorithm.
Step2  :- Let A,B Variables.
Step3  :- Display "Enter the side of the Square.
Step4  :- Accept the side entered by the user.
Step5  :- B=A*A.
Step6  :- Display B.
Step7  :- end the algorithm.


7.Write an algorithm that accepts two numbers and displays the larger of the two. (Duration: 10 Minutes)



Ans   Step1  :- Start the algorithm.
Step2  :- Let A,B,c Variables.
Step3  :- Display "Enter the numbers".
Step4  :- Accept A.
Step5  :- Accept B.
Step6  :- Compare C= A<B.
Step7  :- if c =True.
          Display " B is larger.
Step8  :- Else Display " A is larger.
Step9  :- end the algorithm.

5 comments: