Here is source code of the C program to compute the surface area & volume of a cube. The C program is successfully compiled and run on a Linux system. The program output is also shown below.

`/*`

`* C program to compute the surface area and volume of a cube`

`*/`

`#include <stdio.h>`

`#include <math.h>`

void main()

`{`

float side, surfacearea, volume;

printf("Enter the length of a side \n");

scanf("%f", &side);

surfacearea = 6.0 * side * side;

volume = pow(side, 3);

printf("Surface area = %6.2f and Volume = %6.2f \n", surfacearea,

volume);

`}`

$ cc pgm45.c -lm $ a.out Enter the length of a side 34 Surface area = 6936.00 and Volume = 39304.00

#### Program Explanation:

In this C program, library function is used in header file to compute mathematical functions. We are entering the length of a side using side variable. Now to find the surface area of a cube the formula, surface area = 6 *(side * side) is used. Then, to find the volume of a cube the formula, volume = pow(side,3) is used. Here, the program uses power function defined in math library. Finally, the surface area and volume will be displayed in the standard output.

**Sanfoundry Global Education & Learning Series – 1000 C Programs.**

Here’s the list of Best Reference Books in C Programming, Data-Structures and Algorithms