Rotate your phone or change to desktop for better experience

Rotate your phone or change to desktop for better experience

java array input

 import java.util.Scanner;


class Main{

    public static void main(String arg[]){

    

    int arr[]= new int[100];

    int size;

    Scanner sc = new Scanner(System.in);

    System.out.println("enter the size of the array");

    size = sc.nextInt();

    System.out.println("enter the array elements");

    for ( int i = 0 ; i < size ; i++)

    arr[i] = sc.nextInt();

    System.out.print("your array elemnts are : ");

    for ( int i = 0 ; i < size ; i++)

    System.out.print(arr[i]+"\t");

}

}

Post a Comment

0 Comments