Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions