Computer Science, asked by adi123446, 9 months ago

please can anyone send me some qbasic programs​

Answers

Answered by arham999888777
2

Answer:

1. Write a program to calculate the volume of a cylinder using FUNCTION……END FUNCTION. [Hint: PI*R^2*H]

Ans:

DECLARE FUNCTION VOL(R,H)

CLS

CONST PI=3.14

INPUT “Enter radius and height”; R, H

PRINT “The volume=”; VOL(R,H)

END

FUNCTION VOL(R,H)

V=PI*R^2*H

VOL=V

END FUNCTION

2. Write a program to test whether the given number is positive or negative using SUB……END SUB.

Ans:

DECLARE SUBTEST(N)

CLS

INPUT “Enter a number”; N

CALL TEST(N)

END

SUB TEST(N)

IF N>0 THEN

PRINT N; “is positive number”

ELSE

PRINT N; “is negative number”

END IF

END SUB

3. Write a program to print the following series: 1,4,7,……. up to 10th term using FUNCTION……END FUNCTION.

ANS :

DECLARE FUNCTION SERIES

CLS

D= SERIES

END

FUNCTION SERIES

FOR I = 1 TO 10

PRINT A;

A=A+3

NEXT I

END FUNCTION

4. Write a program which accepts any three different numbers and find the maximum number among them using CALL statement.

Ans:

DECLARE SUB MAX(A,B,C)

CLS

INPUT “Enter any three number’; A,B,C

CALL MAX(A,B,C)

END

SUB MAX(A,B,C)

IF A>B AND A>C THEN

PRINT A; “is maximum number”

ELSEIF B>A AND B>C THEN

PRINT B; “is maximum number”

ELSE

PRINT C; “is maximum number”

END IF

END SUB

5. Write a program to display greater number among any two numbers using FUNCTION……. END FUNCTION.

ANS :

DECLARE FUNCTION GREAT(A,B)

CLS

INPUT “Enter any two number”; A,B

PRINT “The greater number is”; GREAT(A,B)

END

FUNCTION GREAT(A,B)

IF A>B THEN

GREAT= A

ELSE

GREAT=B

END IF

END FUNCTION


adi123446: this is the brainliest answer for me still now. I cannot see the option to mark it brainliest .
Similar questions