Skip to content

Commit 0b0e056

Browse files
Create Print_Using_For_Loop.java
Create java program to print an array using for loop
1 parent 6307824 commit 0b0e056

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class Main {
2+
public static void main(String[] args) {
3+
int[] numbers = {10, 20, 30, 40, 50};
4+
5+
// Using a for loop to print elements
6+
System.out.println("Using for loop:");
7+
for (int i = 0; i < numbers.length; i++) {
8+
System.out.println("Element at index " + i + ": " + numbers[i]);
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)