Created
February 19, 2022 16:01
-
-
Save manjaykumardp/d521260adf08580df43a0c3e4816034b to your computer and use it in GitHub Desktop.
Input array and print it in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.manjay; | |
import java.util.Scanner; | |
public class inputarray { | |
public static void main(String[] args) { | |
System.out.println("Enter numbers of element"); | |
Scanner sc = new Scanner(System.in); | |
int num = sc.nextInt(); | |
int[] arr = new int[num]; | |
for (int i = 0; i <arr.length ; i++) { | |
arr[i]=sc.nextInt(); | |
System.out.print(arr[i]+" "); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment