Write a main function that declares an array of 100 doubles. In a for loop, assi
ID: 3539319 • Letter: W
Question
Write a main function that declares an array of 100 doubles. In a for loop, assign each of the doubles a random number between 0.50 and 50.00 using array[i] = (double) (rand() % 100 + 1) / 2.0; Output the elements of the array in 10 columns that are each 6 spaces wide. Each row in the output will have 10 values. The doubles will be printed with 2 places of accuracy past the decimal. The output of this one-dimensional array requires a single loop with an if statement inside. Even though the 100 numbers are going to be presented as a table of numbers, they are still just a list in memory.Explanation / Answer
//CODED IN C++ /* to change into C, simply replace the first 2 lines with #include #include and remove using namespace std */ #include #include using namespace std; int main() { double array[100]; int i; for(=0;Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.