Question
Rewrite the following code and create a function to display the planets and their diameters. Instead of the code in main, create a function to
Rewrite the following code and create a function to display the planets and their diameters. Instead of the code in main, create a function to do 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(" Planet: "+planet[i]);
Console.Write("\tDiameter: "+diameter[i]);
}
Console.ReadLine();
}
}
need a conclusion statement on this as well. thanks.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started