Computer Science, asked by Ajjubha, 10 months ago

Write A Program in QBasic to display volume of cube,cone, sphere ​

Answers

Answered by SHABING
4

Display volume of sphere.

REM PROGRAM TO DISPLAY VOLUME OF SPHERE.

CLS

INPUT “ENTER RADIUS ”; R

V = (4 / 3) * 3.14 * R ^ 3

PRINT “VOLUME OF SPHERE ”; V

END

USING SUB PROCEDURE

DECLARE SUB VOLUME(R)

CLS

INPUT “ENTER RADIUS”; R

CALL VOLUME(R)

END

SUB VOLUME (R)

V = (4 / 3) * 3.14 * R ^ 3

PRINT “VOLUME OF SPHERE ”; V

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION VOLUME (R)

CLS

INPUT “ENTER RADIUS”; R

PRINT “VOLUME OF SPHERE ”; VOLUME(R)

END

FUNCTION VOLUME (R)

VOLUME = (4 / 3) * 3.14 * R ^ 3

END FUNCTION

Display volume of cube

REM PROGRAM TO DISPLAY VOLUME OF CUBE

CLS

INPUT “ENTER LENGTH”; L

V = L ^ 3

PRINT “VOLUME OF CUBE ”; V

END

USING SUB PROCEDURE

DECLARE SUB VOLUME(L)

CLS

INPUT “ENTER LENGTH”; L

CALL VOLUME(L)

END

SUB VOLUME (L)

V = L ^ 3

PRINT “VOLUME OF CUBE ”; V

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION VOLUME (L)

CLS

INPUT “ENTER LENGTH”; L

PRINT “VOLUME OF CUBE ”; VOLUME(L)

END

FUNCTION VOLUME (L)

VOLUME = L ^ 3

END FUNCTION

volume of cone

#include <stdio.h>

#include <math.h>

int main()

{

float radius, height;

float surface_area, volume;

printf("Enter value of radius and height of a cone :\n ");

scanf("%f%f", &radius, &height);

surface_area = (22 / 7) * radius * (radius + sqrt(radius * radius + height * height));

volume = (1.0/3) * (22 / 7) * radius * radius * height;

printf("Surface area of cone is: %.3f", surface_area);

printf("\n Volume of cone is : %.3f", volume);

return 0;

}

PLEASE MAKE ME AS BRAINIEST...

Answered by bhagatrajeshwar646
0

Answer:

write a q basic program of volume of a cube

Similar questions