C Program to Find Volume and Surface Area of a Cuboid

C program to find volume and surface area of a cuboid; Through this tutorial, we will learn how to find volume and surface area of a cuboid using standard formula and function in c programs.

Programs to Find Volume and Surface Area of a Cuboid in C

  • C Program to Find Volume and Surface Area of a Cuboid using Standard Formula
  • C Program to Find Volume and Surface Area of a Cuboid using Function

C Program to Find Volume and Surface Area of a Cuboid using Standard Formula

/* C Program to find Volume and Surface Area of a Cuboid */
#include <stdio.h>

int main()
{
  float length, width, height;
  float SA, Volume, LSA;

  printf("\nPlease Enter Length of a Cuboid :- ");
  scanf("%f",&length);

  printf("\nPlease Enter Width of a Cuboid :- ");
  scanf("%f", &width);

    printf("\nPlease Enter Height of a Cuboid :- ");
  scanf("%f", &height);

  SA = 2 * (length * width + length * height + width * height);
  Volume = length * width * height;
  LSA = 2 * height * (length + width);

  printf("\n The Surface Area of a Cuboid = %.2f\n",SA);
  printf("\n The Volume of a Cuboid = %.2f\n",Volume);
  printf("\n The Lateral Surface Area of a Cuboid = %.2f\n",LSA);

  return 0;
}

The output of the above c program; as follows:

Please Enter Length of a Cuboid :- 10
Please Enter Width of a Cuboid :- 5
Please Enter Height of a Cuboid :- 15
The Surface Area of a Cuboid = 550.00

 The Volume of a Cuboid = 750.00

 The Lateral Surface Area of a Cuboid = 450.00

C Program to Find Volume and Surface Area of a Cuboid using Function

/* C Program to find Volume and Surface Area of a Cuboid */

#include<stdio.h>

float SurVolLet(float length,float height,float width)
{
  float SA, Volume, LSA;
  SA = 2 * (length * width + length * height + width * height);
  Volume = length * width * height;
  LSA = 2 * height * (length + width);

  printf("\n The Surface Area of a Cuboid = %.2f\n",SA);
  printf("\n The Volume of a Cuboid = %.2f\n",Volume);
  printf("\n The Lateral Surface Area of a Cuboid = %.2f\n",LSA);
}
int main()
{
  float length, width, height;


  printf("\nPlease Enter Length of a Cuboid :- ");
  scanf("%f",&length);

  printf("\nPlease Enter Width of a Cuboid :- ");
  scanf("%f", &width);

  printf("\nPlease Enter Height of a Cuboid :- ");
  scanf("%f", &height);

  SurVolLet(length, height, width);

  return 0;
}

The output of the above c program; as follows:

Please Enter Length of a Cuboid :- 5
Please Enter Width of a Cuboid :- 4
Please Enter Height of a Cuboid :- 10
The Surface Area of a Cuboid = 220.00

 The Volume of a Cuboid = 200.00

 The Lateral Surface Area of a Cuboid = 180.00

Recommended C Programs

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *