Computer Science, asked by vighneshpeta, 10 months ago

write a program to accept set of 8 integers and print array elements along with the index number of each elements and square of each element in three columns​

Answers

Answered by akshayamca14
0

Answer:

import java.util.*;  

public class Main

{

public static void main(String[] args) {

    Scanner in = new Scanner(System.in);  

    Integer [] numbers=new Integer[8];

 System.out.println("Enter number:");

 for (int i=0;i<8 ;i++ )

 {

     numbers[i]=in.nextInt();

 }

 System.out.println("Index|Value|Square");

 for (int i=0;i<8 ;i++ )

 {

     System.out.println(i+"\t"+numbers[i]+"\t"+numbers[i]*numbers[i]);

 }

}

}

Explanation:

Similar questions