0

1 dan 100 gacha bo‘lgan sonlar orasidan tub sonlarni chiqaruvchi dastur tuzing

Masalan

30th Dec 2018, 4:58 AM
Shirinoy Muhsinjonova
Shirinoy Muhsinjonova - avatar
3 Respuestas
+ 1
Sirius Black: Shirinoy Muhsinjonova: class Misol { public static void main(String[] args) { int i; int a; int s; for (i=1; i<=100; i++) {s=0; for(a=1; a<=i; a++){ if(i%a==0) s++; } if(s==2) ; System.out.println(i); } } } is it true?
30th Dec 2018, 4:58 AM
Shirinoy Muhsinjonova
Shirinoy Muhsinjonova - avatar
0
Yeah, it's true. But it requires much more resources. So, you can and must optimize it.
2nd Jan 2019, 11:13 AM
Timur
Timur - avatar