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 10 numbers in an array
Java program to accept 10 numbers in an array
Output:
Enter 10 numbers:
1 2 3 4 5 6 7 8 9 10
The array entered is: 1 2 3 4 5 6 7 8 9 10
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); int[] array; array = new int[10]; System.out.println("Enter the 10 numbers:"); for(int i=0;i<10;i++) { array[i] = in.nextInt(); } System.out.print("The array entered is: "); for(int i=0;i<10;i++) { System.out.print(" "+array[i]); } } }
PREVIOUS
NEXT
HOME