SCHOOL OF CODE BUILDERS
Learn To CODE. Become A DEVELOPER.
Pages
HOME
DATA STRUCTURES
STRINGS
ARRAYS
MATRIX
BINARY TREES
LINKED LIST
STACK
QUEUE
SORTING
SEARCHING
C
PYTHON
PSEUDOCODE
CONTEST PROBLEMS
ALGORITHMS
PATTERNS
PHP
C PUZZLES
C INTERVIEW QUESTIONS
JAVA
C++
HASHING
RECURSION
BASIC C PROGRAMS
TCS-CODEVITA
FACEBOOK
CONTACT US
Java program to accept an array of numbers
Java program to accept an array of numbers
Output:
How many integers ?:
5
Enter 5 integers:
1 2 3 4 5
The array is:
a[0] = 1
a[1] = 2
a[2] = 3
a[3] = 4
a[4] = 5
Implementation:
import java.util.*; import java.lang.*; import java.io.*; class CodeRegister { public static void main (String[] args) throws java.lang.Exception { Scanner in = new Scanner(System.in); System.out.println("How many integers ?:"); int n = in.nextInt(); System.out.println("Enter "+n+" integers:"); int[] a=new int[n]; for(int i=0;i
PREVIOUS
NEXT
HOME