-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMatrisSatirSutunOrtalamasiBulma.java
66 lines (51 loc) · 1.35 KB
/
MatrisSatirSutunOrtalamasiBulma.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import java.util.Scanner;
public class Main {
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
int satir, sutun;
System.out.print("Satir sayisi : ");
satir = scanner.nextInt();
System.out.print("Sutun sayisi : ");
sutun = scanner.nextInt();
int[][] dizi = new int[satir][sutun];
for(int i=0; i<satir; i++)
{
for(int j=0; j<sutun; j++)
{
System.out.println(i+". satir " + j + ". sutun elemanini giriniz : ");
dizi[i][j] = scanner.nextInt();
}
}
System.out.println("\n -- DIZI --\n");
for(int i=0; i<satir; i++)
{
for(int j=0; j<sutun; j++)
{
System.out.print(dizi[i][j] + " ");
}
System.out.println("\n");
}
System.out.println("-------------------------");
System.out.println("\n-- Satir Ortalamalari --\n");
for(int i=0; i<satir; i++)
{
int satirtoplam = 0;
for(int j=0; j<sutun; j++)
{
satirtoplam += dizi[i][j];
}
System.out.println(i+". satir ortalamasi : " + (satirtoplam/sutun));
}
System.out.println("\n-- Sutun Ortalamalari --\n");
for(int i=0; i<sutun; i++)
{
int sutuntoplam = 0;
for(int j=0; j<satir; j++)
{
sutuntoplam += dizi[j][i];
}
System.out.println(i +". sutun ortalamasi : " + (sutuntoplam/satir));
}
}
}