-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathikizAsalSayilar2.java
More file actions
44 lines (28 loc) · 919 Bytes
/
ikizAsalSayilar2.java
File metadata and controls
44 lines (28 loc) · 919 Bytes
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
package projeler;
public class ikizAsalSayilar2 {
public static void main(String[] args) {
/*
SORU 16 :
İKİZ SAYİLARİ BULMA PROGRAMINI YAPMIŞTIK.
İKİ TANE İKİZ SAYIYININ CARPIMILARINA BİR EKLENİRSE TAM KARE BİR DEGER OLACAK
İKİZ SAYİLARİ BULUP CARPIMLARINA BİR EKLENİP TAM KAREYE CEVİREN UYGULMA
*/
boolean durum = true;
int asal = 0;
for (int counter = 10; counter < 100; counter++) {
for (int counter2 = counter - 1; counter2 > 1; counter2--) {
if (counter % counter2 == 0) {
durum = false;
}
}
if (durum == true) {
if (counter - asal == 2) {
int tamKare = counter * asal + 1;
System.out.println("iki ikiz asal sayini carpimi sonucu olusan tam kare = " + tamKare);
}
asal = counter;
}
durum = true;
}
}
}