//https://csprograms4u.blogspot.com/
//Chapter 4
//Program 1
//One Dimensional Array
import
java.util.Scanner;
public class Array1D
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a[]=new int[100];
System.out.println("How many
elements you want to enter");
int n=sc.nextInt();
System.out.println("Enter
elements");
for(int i=1;i<=n;i++)
{
a[i]=sc.nextInt();
}
System.out.println("Entered
elements are");
for(int i=1;i<=n;i++)
{
System.out.print("\t"+a[i]);
}
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.