Skip to content

Commit 710971f

Browse files
authored
Create Kosegenibir.java
1 parent 94541f2 commit 710971f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Kosegenibir.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.company;
2+
3+
import java.util.Scanner;
4+
5+
public class Kosegenibir {
6+
public static void main(String args[]){
7+
Scanner scanner = new Scanner(System.in);
8+
System.out.print("Sayı Giriniz: ");
9+
int sayi = scanner.nextInt();
10+
if(sayi >= 2){
11+
int[][] dizi = new int[sayi][sayi];
12+
for(int i = 0; i<sayi; i++){
13+
dizi[i][i] = 1;
14+
}
15+
16+
for(int a = 0; a < sayi; a++){
17+
for(int b = 0; b < sayi; b++){
18+
System.out.print(dizi[a][b]+" ");
19+
}
20+
System.out.println("");
21+
}
22+
}else{
23+
System.out.println("Sayı 1'den büyük olmalıdır.");
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)