Answer:
#include <iostream>
using namespace std;
<em>float</em><em> calculate_sq_inches_of_good_pizza(float diameter) {
</em>
<em> </em><em>float</em><em> radius= diameter/2; </em>
<em> </em><em>float</em><em> pi=3.14;</em>
<em> </em><em>float</em><em> area; </em>
<em> area = pi</em><em>*</em><em>(radius</em><em>*</em><em>radius
);</em>
<em> </em><em>return</em><em> area;</em>
<em>}
</em>
int main() {
float d;
cout<<"enter the diameter of pizza"<<endl;
cin>>d>>endl;
float area_of_pizza = calculate_sq_inches_of_good_pizza();
return 0;
}
Explanation:
Above program is written in C++ language which has function namely float calculate_sq_inches_of_good_pizza(float diameter). This will calculate area of pizza from given diameter and return it to main() function.
As we know pizza is circle and area of circle is equal to:
Area = π * radius*radius
π =pi=3.14
and we have calculated radius from given diameter
radius = diameter/2;
If you only want function not whole program than ignore main () function and only consider float calculate_sq_inches_of_good_pizza(float diameter) function which is in ITALIC notation.