package Java;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println(" ENTER size:");
Scanner input=new Scanner(System.in);
int rows=input.nextInt();
int colums=input.nextInt();
System.out.println(" ENTER Elemnt:");
int arr[][]=new int[rows][colums];
for(int i=0;i<rows;i++){
for (int j=0;j<colums;j++){
arr[i][j]=input.nextInt();
}
}
printArray(arr);
System.out.println();
int max;
max=arr[0][0];
if(arr[i][j]>max)
max=arr[i][j];
for(int i=0;i<rows;i++){
for (int j=0;j<colums;j++){
System.out.println(max);
}
}
int R,C,SR,SC;
R=arr.length;
C=arr[0].length;
for(int i=0;i<R;i++){
SR=0;
for(int j=0;j<C;j++){
SR+=arr[i][j];
}
System.out.println("sum of row :"+(i+1)+":="+SR);
}
for(int i=0;i<C;i++){
SC=0;
for(int j=0;j<R;j++){
SC+=arr[j][i];
}
System.out.println("sum of colum :"+(i+1)+":="+SC);
}
}
static void printArray(int a [] []){
System.out.println(" Data ");
for(int []x:a){
for(int y:x){
System.out.print(y+" ");
}
System.out.println();
}
}
}
١/ايجاد اكبر عنصر في المصفوفة
٢/ايجاد اكبر مجموع صفوف