import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
System.out.println("Enter the size of the arrays: ");
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
double [] length = new double[n];
double [] width = new double[n];
double [] area = new double[n];
for(int i =0; i<n; i++){
System.out.println("Enter the Length and Width for Rectangle: "+ (i+1));
length[i] = scan.nextDouble();
width[i] = scan.nextDouble();
area[i] = length[i] * width[i];
}
System.out.println("Length Width Area \n");
System.out.println("--------------------------------\n");
for(int i =0; i<n; i++){
System.out.println(length[i]+" "+width[i] +" "+area[i]);
}
}
}
Comments
Leave a comment