Write a program that counts from one to ten, prints the values on a
separate line for each, and includes a message of your
choice when the count is 3 and a different message when
the court is 7
Answers
Answered by
0
public class ArrayDemo {
public static void main(String[] args) {
int[] anArray; // declare an array of integers
anArray = new int[10]; // create an array of integers
// assign a value to each array element and print
for (int i = 0; i < anArray.length; i++) {
anArray[i] = i;
System.out.print(anArray[i] + " ");
}
System.out.println();
}
}
The output from this program is:
0 1 2 3 4 5 6 7 8 9
Similar questions