Create a script that calculates the volume of a Dodecahedron

Create a script that calculates the volume of a Dodecahedron for a given value of ‘side’: (15+ 7 multiplied by square root of 5, all divided by 4.)side cubed. Now call the script for multiple values of ‘side’ using a 1-line for loop. Show the output volume for at least 5 different values of ‘side’. could you please write me the code for this

Solution

Assuming that you know how the volume was calculated and that you have verified the given formula for volume of dodecahyderon, and that the script you need can be in C and that you either have a c compiler otherwise an internet connection with which you may run your code online at http://codepad.org/, a simple script for your problem may be as follows:

#include<stdio.h>

int main(int agrc, char* argv[])
{
float side[5],volume[5];
int i;
for(i=1;i<6;i++){side [i]= i*6.7665; volume[i] = ((15+7*sqrt(5))*side[i]*side[i]*side[i])/4;
                 printf(\"For side = %f, volume = %f\ \",side[i],volume[i]);
                }
return 0;
}

Create a script that calculates the volume of a Dodecahedron for a given value of ‘side’: (15+ 7 multiplied by square root of 5, all divided by 4.)side cubed. N

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site