Thursday, 16 September 2021

Write a sub program to display the acceleration of car. The program should ask initial velocity, final velocity and time taken by the car from user in main module and pass them as parameter list when a sub program is called.

Write a sub program to display the acceleration of car. The program should ask initial velocity, final velocity and time taken by the car from user in main module and pass them as parameter list when a sub program is called.

 

DECLARE SUB accel(u, uf, t)

CLS

      PRINT "Acceleration of Car"

      INPUT "Enter initial velocity of a car"; a

      INPUT "Enter final velocity of a car"; b       

INPUT "Enter time taken by of a car"; c

CALL accel(a, b, c)

END

SUB accel(u, uf, t)

      LET ac = (uf-u)/t

      PRINT "Acceleration of car is:::::"; ac

END SUB

Write a sub-procedure to find the solution of quadratic equation ax2 +bx +c=0. The program should ask the value of a, b, and c from user in main module and pass them as parameter list when a sub program is called.

Write a sub-procedure to find the solution of quadratic equation ax2 +bx +c=0. The program should ask the value of a, b, and c from user in main module and pass them as parameter list when a sub program is called.

 

DECLARE SUB value(a, b, c)

CLS

           PRINT "Calculate ax^2+bx+c=0"

           INPUT "Enter a value of a"; a

           INPUT "Enter a value of b"; b

           INPUT "Enter a value of c"; c

CALL value(a, b, c)

END

SUB Triangle

           LET d=(b*b-4*a*c)^1/2

           LET x = (-b+d)/2*a

           LET y = (-b-d)/2*a

           PRINT "Result of quadratic equation are x, y"; x, y

END SUB

 

Write a sub program to print area of a cylinder, radius and height of cylinder are given by the user in main module and pass them as parameter list when sub program is called.

Write a sub program to print area of a cylinder, radius and height of cylinder are given by the user in main module and pass them as parameter list when sub program is called.

 

DECLARE SUB cyl(r, h)

CLS

           INPUT "Enter a radius"; r

           INPUT "Enter a height"; h

CALL cyl(r, h)

END

SUB Triangle

           LET Area = (22/7)*r^2*h

           PRINT "Area of triangle is", Area

END SUB

Write a program to input base and height of the triangle from user. The program should calculate and display the area of triangle using SUB – END SUB statement.

 

a.     Write a program to input base and height of the triangle from user. The program should calculate and display the area of triangle using SUB – END SUB statement.(Hint: A=1/2bh)

 

DECLARE SUB Triangle( )

CLS

        CALL Triangle

END

SUB Triangle

        INPUT "Enter a base of triangle"; b

        INPUT "Enter a height of triangle"; h

        LET Area = (1/2) *b*h

        PRINT "Area of triangle is", Area

END SUB

       

MCQ Question Bank Microsoft PowerPoint