daily pastebin goal
22%
SHARE
TWEET

Scanning java

a guest Jan 20th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. package array.input;
  3. import java.util.Scanner;
  4. public class ArrayInput {
  5.  
  6.    
  7.     public static void main(String[] args) {
  8.         Scanner input = new Scanner (System.in);
  9.         System.out.print("How many element do you want to enter/ Array size : ");
  10.         int n = input.nextInt();
  11.         int a[]= new int[n];
  12.         System.out.print("Enter the elemebt : ");
  13.         for (int i =0 ; i<a.length ; i++)
  14.         {
  15.             a[i]=input.nextInt();
  16.            
  17.         }
  18.          for (int i =0 ; i<a.length ; i++)
  19.         {
  20.             System.out.print(a[i]+" ");
  21.         }
  22.     }
  23.    
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top