Kotlinlearncs.online LogoJava
Return to List

Solve: Print the First n Elements

Created By: Justin Maier
/ Version: 2024.7.0

Given an array of double values named prices and a nonnegative int variable n, print the first n elements in prices, each on their own line.

If n is greater than the length of the array, print all the elements of the array.

If n is 0, you should print nothing.

Related Lessons

Stuck? You may find these lessons helpful: