004-002-015
Array Creation: Double Array
Medium
Problem Description
array Creation: Double array
In this problem, you will create a program that reads an array size from standard input, creates a double array named prices, outputs the array length, and displays the default value of the first element to standard output.
Learning Objective: Understand how to create double arrays, check default values, and read input using Scanner
Overview
Create a program that creates a double array based on the input size and outputs array information.
Input
N
- Line 1: Array size N (integer, 1 or greater)
Specifications
- Read the array size from standard input
- Create a double array named
prices(size: input value) - Output the array length
- Output the first element (index 0) value (to check default value)
Output Format
Array length: N
First element: 0.0
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up