3.
Write a C++ program to input the side a of a cube, calculate and display its volume and
surface area. (Note. Volume = a?, Surface area = 6a²)
please answer it correctly
I really need it urgently.
if you give me the right answer then I will mark your answer as brainliest!
please please please help me!!!!
Answers
Answered by
4
Answer:
Examples:
Input : Side of a cube = 2
Output : Area = 8
Total surface area = 24
Input : Side of a cube = 3
Output : Area = 27
Total surface area = 54
// CPP program to find area
// and total surface area of cube
#include <bits/stdc++.h>
using namespace std;
// utility function
double areaCube(double a)
{
return (a * a * a);
}
double surfaceCube(double a)
{
return (6 * a * a);
}
// driver function
int main()
{
double a = 5;
cout << "Area = " << areaCube(a) << endl;
cout << "Total surface area = " << surfaceCube(a);
return 0;
}
THIS IS AN EXAMPLE ONLY.
Similar questions