Create function to display the planets and their diameters


Rewrite the following code and create function to display the planets and their diameters. Instead of the code in main, create the function to this. Pass both arrays to the function.
static void Main(string[] args)
{
string[] planet = new string[]{"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"};
double[] diameter = new double[] { 4879, 12104, 12756, 6792, 142984, 120536, 51118, 49528 };
Console.WriteLine("Each planet and its diameter are shown below:");
for(int i=0;i<8;i++)
{
Console.Write("nPlanet: "+planet[i]);
Console.Write("tDiameter: "+diameter[i]);
}
Console.ReadLine();


}
}

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Create function to display the planets and their diameters
Reference No:- TGS02538603

Now Priced at $10 (50% Discount)

Recommended (91%)

Rated (4.3/5)