import java.util.Scanner;
class sda
{
public static void main(String x[])
{
int n,i;
Scanner s=new Scanner(System.in);
System.out.println("Enter Size Of Array :");
n=s.nextInt();
int[] a;//declaration of array
a=new int[n]; // Creation of array with given size
for(i=0;i<n;i++)
{
System.out.printf("\n Element a[%d] :",i);
a[i]=s.nextInt();
}
System.out.print("\n Array elements :");
for(i=0;i<n;i++)
{
System.out.print(a[i]+" ");
}
for(i=0;i<n;i++)
{
System.out.printf("\n\n ADDRESS=%h ---- ARRAY=a[%d]------ DATA=%d",i*4,i,a[i]);
}
}
}
output:
No comments:
Post a Comment