Surface Area Of Pentagonal Prism
Program to find volume and surface area of pentagonal prism
A prism that has 5 rectangular faces and two parallel pentagonal bases is a pentagonal prism. So y'all are given the apothem length(a), base length(b) and meridian(h) of the pentagonal prism. you accept to find the surface area and the volume of the Pentagonal Prism.
Examples:
Input : a=3, b=five, h=half dozen Output :area=225, book=225 Input : a=2, b=3, h=5 Output :surface surface area=105, volume=75
In this figure,
a– apothem length of the Pentagonal Prism.
b– base length of the Pentagonal Prism.
h– superlative of the Pentagonal Prism.
Formulas:Below are the formulas for calculating the surface area and the volume of the Pentagonal Prism.
C++
#include <$.25/stdc++.h>
using
namespace
std;
float
surfaceArea(
float
a,
float
b,
bladder
h)
{
return
v * a * b + v * b * h;
}
bladder
volume(
bladder
b,
bladder
h)
{
render
(5 * b * h) / 2;
}
int
principal()
{
float
a = 5;
bladder
b = 3;
float
h = 7;
cout <<
"surface expanse= "
<< surfaceArea(a, b, h) <<
", "
;
cout <<
"book= "
<< volume(b, h);
}
Java
import
java.util.*;
form
solution
{
static
float
surfaceArea(
float
a,
bladder
b,
float
h)
{
return
5
* a * b +
5
* b * h;
}
static
float
volume(
float
b,
bladder
h)
{
return
(
5
* b * h) /
2
;
}
public
static
void
chief(String arr[])
{
float
a =
5
;
bladder
b =
3
;
float
h =
7
;
Organization.out.println(
"surface surface area= "
+surfaceArea(a, b, h)+
", "
);
System.out.println(
"volume= "
+book(b, h));
}
}
Python3
def
surfaceArea(a, b, h):
return
v
*
a
*
b
+
5
*
b
*
h
def
volume(b, h):
return
(
five
*
b
*
h)
/
ii
if
__name__
=
=
'__main__'
:
a
=
5
b
=
3
h
=
7
impress
(
"surface expanse ="
, surfaceArea(a, b, h),
","
,
"book ="
, volume(b, h))
C#
using System;
class
GFG
{
static
bladder
surfaceArea(
bladder
a,
float
b,
float
h)
{
return
five
* a * b +
5
* b * h;
}
static
float
book(
float
b,
float
h)
{
return
(
v
* b * h) /
ii
;
}
public
static
void
Main()
{
float
a =
5
;
bladder
b =
3
;
bladder
h =
7
;
Console.WriteLine(
"surface expanse = "
+
surfaceArea(a, b, h) +
", "
);
Panel.WriteLine(
"volume = "
+
volume(b, h));
}
}
PHP
<?php
part
surfaceArea(
$a
,
$b
,
$h
)
{
return
5 *
$a
*
$b
+
five *
$b
*
$h
;
}
function
book(
$b
,
$h
)
{
return
(five *
$b
*
$h
) / 2;
}
$a
= five;
$b
= three;
$h
= 7;
echo
"surface surface area = "
,
surfaceArea(
$a
,
$b
,
$h
) ,
", "
;
echo
"volume = "
, volume(
$b
,
$h
);
?>
Javascript
<script>
function
surfaceArea( a, b, h)
{
return
5 * a * b + v * b * h;
}
function
book( b, h)
{
return
(v * b * h) / 2;
}
allow a = five;
permit b = 3;
let h = 7;
document.write(
"surface area= "
+ surfaceArea(a, b, h) +
", "
);
document.write(
"volume= "
+ volume(b, h));
</script>
Output:
expanse= 180, book= 52.v
Time complexity: O(1)
Auxiliary Space: O(1)
Surface Area Of Pentagonal Prism,
Source: https://www.geeksforgeeks.org/program-to-find-volume-and-surface-area-of-pentagonal-prism/
Posted by: stilesthicaltat.blogspot.com
0 Response to "Surface Area Of Pentagonal Prism"
Post a Comment