-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforLoop.java
More file actions
27 lines (21 loc) · 778 Bytes
/
forLoop.java
File metadata and controls
27 lines (21 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.Scanner;
public class forLoop {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Welcome to Array Itration with for Loop ");
System.out.print("Enter the Array Length : ");
int ArrayLength = input.nextInt();
input.nextLine();
String[] MyArray= new String[ArrayLength];
for(int i=0; i < ArrayLength; i++){
System.out.print("Enter the " + (i + 1) + "Number Name : ");
MyArray[i] = input.nextLine();
}
// output Check
System.out.println("\nYou Entered : ");
for(int i = 0; i < ArrayLength; i++){
System.out.print(MyArray[i] + " ");
}
input.close();
}
}