The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Array
By Guest on 7th October 2024 07:45:32 AM | Syntax: PYTHON | Views: 18



New Paste New paste | Download Paste Download | Toggle Line Numbers Show/Hide line no. | Copy Paste Copy text to clipboard
  1. import java.io.DataInputStream;
  2. import java.io.*;
  3. class InitArray
  4. {
  5. public static void main(String args[])
  6. {
  7. try
  8. {
  9. int n;
  10. int a[]= new int [20];
  11. DataInputStream in = new DataInputStream(System.in);
  12. System.out.println("Enter the Array Limit");
  13.  n=Integer.parseInt(in.readLine());
  14.  
  15. System.out.println("Enter the Array elements");
  16. for(int i=0;i<n;i++)
  17. {
  18.  a[i]=Integer.parseInt(in.readLine());
  19. }
  20.  
  21. System.out.println("Array elements");
  22. for(int i=0;i<n;i++)
  23. {
  24.  System.out.println(a[i]);
  25. }
  26. }
  27. catch (Exception e)
  28. {
  29. }
  30. }
  31. }





array    





  • Recent Pastes