Taking Array Input
CODE
import java.util.Scanner;
public class orange {
public static void main (String args[]) {
int test[] = new int[15];
int n;
Scanner bucky = new Scanner(System.in);
System.out.println("How many elements you want in your array");
n = bucky.nextInt();
System.out.println("Enter the elements of array");
for(int i=0;i<n;i++) {
test[i] = bucky.nextInt(); // array input ke liye hum for loop use karte hai
}
System.out.println("Your array is ");
for(int j =0;j<n;j++) {
System.out.println(test[j]);
}
}
}
Comments
Post a Comment