Skip to content
Home » C Program to Find the Area of a Cube

C Program to Find the Area of a Cube

Learn about C Program to Find the Area of a Cube in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

C Program to Find the Area of a Cube

A cube’s total surface area is the area covered by all six of its faces. The formula for calculating the total surface area of a cube is as follows: Total surface area = 6a2, where ‘a’ is the cube’s edge length.

Program:

#include<stdio.h>
int main()
{
  double length, area;
  printf("Enter length: ");
  scanf("%lf",&length);

  area = 6*length*length;
  printf("Area=%.2f",area);

  return 0;
}

Output:

Enter length: 4
Area=96.00

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
C Program to Find the Circumference of a Rectangle
C Program to Find the Circumference of a Triangle