Question: The code below shows how to print an array using Index based for loop and iterator based for loop. Index based for loop: Int[] array={1,2,4,5,7};

The code below shows how to print an array using Index based for loop and iterator based for loop.
Index based for loop:
Int[] array={1,2,4,5,7};
for (int i = 0; i < array.length; i++) System.out.println(array[i]);
Iterator based for loop:
for (int datum : array) System.out.println(datum);
Now write code generate 10 random numbers and assign it to an array. Now find the factorial of those 10 random numbers generated assign it to another array. Now print the output using Iterator based for loop and Index based for loop.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!