204,031 views
38 votes
38 votes
Write a program that creates an array of four float elements. Use a for loop to read and store a float value at each index in the array. Then use a for-each loop to print out each element to the console.

User The Lazy Hiker
by
2.7k points

1 Answer

24 votes
24 votes

Answer:

So, for an old fashioned loop over a floatArray, you need an int for the index and a float for the value.

Step-by-step explanation:

If floatArray = [2.2, 4.4, 6.6, 8.8]

User Perseus
by
2.5k points