Difference between revisions of "Printing an Array"

From CompSciWiki
Jump to: navigation, search
Line 1: Line 1:
 
{{1010PrAD|ProblemName=Printing an Array
 
{{1010PrAD|ProblemName=Printing an Array
  
|Problem= This problem involves you printing out an array of integers using a <b>for loop</b>. You want to make an array of 10 integers with values you can hard code into the program. Remember that you can create an array of any type with hard coded values like this:
+
|Problem= This problem involves you printing out an array of integers using a <b>for loop</b>. You want to make an array of 10 integers with values you can hard code into the program. Use <b>System.out.println()</b> to print out the integers. Remember that you can create an array of any type with hard coded values like this:
 
<pre>
 
<pre>
 
int[] array = {1, 2, 3};
 
int[] array = {1, 2, 3};
Line 14: Line 14:
 
An image or By Students section
 
An image or By Students section
  
|Solution=The solution...
+
|Solution=
  
 
}}
 
}}

Revision as of 12:03, 1 April 2010

Back to the Program-A-Day homepage

Problem

This problem involves you printing out an array of integers using a for loop. You want to make an array of 10 integers with values you can hard code into the program. Use System.out.println() to print out the integers. Remember that you can create an array of any type with hard coded values like this:

int[] array = {1, 2, 3};
 

SideSectionTitle

float
Taken from http://www.flickr.com/photos/daniello/565304023/

An image or By Students section

Solution

Code

SolutionCode goes here. Please DO NOT put your code in <pre> tags!

Back to the Program-A-Day homepage