السلام عليكم
لو سمحتو عندي كود لسؤال احس انه ناقص
وفيه جزء من السؤال ما قدرت الى الان
السؤال:
اقتباس1- Write a program to declare a 4x4 array. Display that array in rows and columns. At the end of each row display the sum of the row elements and the sum of their squares.2- Find the maximum and minimum integers in each row and display.
3- Find the average in each row and the overall average.
4- Write a method that takes three 3x3 arrays and find the result of multiplying the first two array storing the result in the third one.
public static void main(String[] args)
{
int[][] array;
array = new int [4][4];
int i, j;
int sum = 0;
int sumSqr = 0;
double averg;
double overallavr = 0;
int min = 15;
int max = 0;
int square;
System.out.print("1st num\t2nd num\t3rd num\t4th num\tsum\tsum Square\tmax\tmin\taverege\n");
for (i = 0; i < 4; i++)
{
max = 0;
min = 15;
sum = 0;
sumSqr = 0;
for (j = 0; j < 4; j++)
{
array[j] = 1 + (int) (Math.random() * 15);
square = array[j] * array[j];
sum = sum + array[j];
sumSqr = sumSqr + square;
if (array[j] > max)
max = array[j];
if (array[j] < min)
min = array[j];
System.out.print(array[j] + "\t");
}
averg = sum / 4.0;
overallavr = overallavr + averg;
System.out.print(sum + "\t" + sumSqr + "\t\t" + max + "\t" + min + "\t" + averg + "\n");
}
System.out.print("The overall averege is =" + overallavr / 4.0);
}