Skip to content

Commit bf943d5

Browse files
author
Hud
committed
GITA MASALA
1 parent d81f6e1 commit bf943d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+349
-25
lines changed
Binary file not shown.
Binary file not shown.
741 Bytes
Binary file not shown.
Binary file not shown.
864 Bytes
Binary file not shown.
Binary file not shown.
385 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.

out/production/GitaProjects/fori.zip

15.2 KB
Binary file not shown.
1.49 KB
Binary file not shown.
935 Bytes
Binary file not shown.
961 Bytes
Binary file not shown.
Binary file not shown.
1.02 KB
Binary file not shown.
1.17 KB
Binary file not shown.
1.01 KB
Binary file not shown.
983 Bytes
Binary file not shown.
973 Bytes
Binary file not shown.
952 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1.28 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
923 Bytes
Binary file not shown.
Binary file not shown.
702 Bytes
Binary file not shown.
780 Bytes
Binary file not shown.
763 Bytes
Binary file not shown.
809 Bytes
Binary file not shown.
817 Bytes
Binary file not shown.
858 Bytes
Binary file not shown.
680 Bytes
Binary file not shown.
Binary file not shown.
923 Bytes
Binary file not shown.
384 Bytes
Binary file not shown.
995 Bytes
Binary file not shown.
892 Bytes
Binary file not shown.
868 Bytes
Binary file not shown.
Binary file not shown.
998 Bytes
Binary file not shown.
934 Bytes
Binary file not shown.
922 Bytes
Binary file not shown.
928 Bytes
Binary file not shown.
931 Bytes
Binary file not shown.
919 Bytes
Binary file not shown.
1001 Bytes
Binary file not shown.
384 Bytes
Binary file not shown.
Binary file not shown.
873 Bytes
Binary file not shown.
904 Bytes
Binary file not shown.
Binary file not shown.
843 Bytes
Binary file not shown.
885 Bytes
Binary file not shown.

src/fori.zip

15.2 KB
Binary file not shown.

src/whileGita/Example3.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package whileGita;
2+
3+
import java.util.Scanner;
4+
5+
public class Example3 {
6+
public static void main(String[] args) {
7+
Scanner scanner = new Scanner(System.in);
8+
9+
10+
while (true) {
11+
System.out.println("1. Start Game");
12+
System.out.println("2. Lead board");
13+
System.out.println("3. About");
14+
System.out.println("4. Exit");
15+
System.out.print("Select menu, please: ");
16+
int input = scanner.nextInt();
17+
18+
if (input == 1) System.out.println("Start game");
19+
if (input == 2) System.out.println("Lead board");
20+
if (input == 3) System.out.println("About");
21+
if (input == 4) {
22+
System.out.println("Exit");
23+
break;
24+
}
25+
}
26+
27+
28+
}
29+
}

src/whileGita/Example5.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package whileGita;
2+
3+
public class Example5 {
4+
5+
public static void main(String[] args) {
6+
// System.out.println((int) Math.sqrt(997));
7+
tubNumber(1000);
8+
}
9+
10+
11+
// 2 3 5 7 11 13 17 19 23 29 ...
12+
public static void tubNumber(int n) {
13+
for (int i = 2; i <= n; i++) {
14+
if (tub(i)) System.out.print(i + " ");
15+
}
16+
}
17+
18+
// n
19+
// 1 2 3 4 5 ... sqrt(n)
20+
public static boolean tub(int number) {
21+
int i = 2;
22+
while (i < Math.sqrt(number)) {
23+
if (number % i == 0)
24+
return false; // tub emas
25+
i++;
26+
}
27+
return true; // tub
28+
}
29+
}

src/whileGita/PinCode.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package whileGita;
2+
3+
import java.util.Scanner;
4+
5+
public class PinCode {
6+
public static void main(String[] args) {
7+
// pin code to'g'ri kiritilsa keyingi qadamga o'tilsin
8+
Scanner scanner = new Scanner(System.in);
9+
int MY_PIN_CODE = 1234;
10+
int pinCode;
11+
do {
12+
System.out.print("Enter pin code: ");
13+
pinCode = scanner.nextInt();
14+
} while (pinCode != MY_PIN_CODE);
15+
16+
while (true) {
17+
if (pinCode != MY_PIN_CODE) {
18+
System.out.print("Enter pin code: ");
19+
pinCode = scanner.nextInt();
20+
} else break;
21+
}
22+
23+
System.out.println("Xush kelibsiz");
24+
}
25+
}

src/whileGita/While28.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static void main(String[] args) {
99
// e = 0.1
1010
public static void solution(double e) {
1111
double a1, ak = 2;
12-
int k = 1; // k -> 2, 3, 4, 5, 6...
12+
int k = 1; // k > 2, 3, 4, 5, 6...
1313
do {
1414
a1 = ak; // a1=2.5
1515
k++; // 2

src/whileGita/While5.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ public class While5 {
44

55
public static void main(String[] args) {
66
System.out.println(solution(64)); // 6
7-
System.out.println(solution2(64)); // 6
87
}
98

109
// 2 4 8 16 32 64 128 256 ...
@@ -20,12 +19,4 @@ public static int solution(int n) {
2019

2120
// 2 4 8 16 32 64 128 256 ...
2221
// 32 -> 2^k k=5
23-
public static int solution2(int n) {
24-
int k = 1, degree = 0;
25-
while (k < n) {
26-
k *= 2; // 2 4 8 16 32 64
27-
degree++; // 1 2 3 4 5 6
28-
}
29-
return degree;
30-
}
3122
}

src/whileGita/while14.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package whileGita;
2+
3+
import java.util.Scanner;
4+
5+
public class while14 {
6+
public static void main(String[] args) {
7+
float a;
8+
Scanner scanner=new Scanner(System.in);
9+
10+
System.out.print("A:");
11+
a = scanner.nextInt();
12+
int k = 0;
13+
float temp = 0F;
14+
while (temp <= a)
15+
{
16+
++k;
17+
temp += 1 / (float)k;
18+
}
19+
System.out.print("K:");
20+
System.out.print(k - 1);
21+
System.out.print("\n");
22+
System.out.print("Nsum:");
23+
System.out.print(temp - 1 / (float)k);
24+
25+
}
26+
}

src/whileGita/while17.java

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,19 @@
44

55
public class while17 {
66
public static void main(String[] args) {
7-
int n;
87
Scanner scanner=new Scanner(System.in);
9-
8+
int n,m;
109
System.out.print("N:");
1110
n = scanner.nextInt();
12-
int sum = 0;
13-
int num = 0;
14-
while (n > 0)
11+
System.out.print("M:");
12+
m = scanner.nextInt();
13+
14+
while (n > m)
1515
{
16-
++num;
17-
sum += n % 10;
18-
n /= 10;
16+
System.out.print(n % m);
17+
n /= m;
1918
}
20-
System.out.print("Num:");
21-
System.out.print(num);
22-
System.out.print("\n");
23-
System.out.print("Sum:");
24-
System.out.print(sum);
19+
2520
}
2621

2722
}

src/whileGita/while18.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package whileGita;
2+
3+
import java.util.Scanner;
4+
5+
public class while18 {
6+
public static void main(String[] args) {
7+
//
8+
Scanner scanner = new Scanner(System.in);
9+
10+
int n;
11+
int r = 0; //
12+
System.out.print("N: ");
13+
n = scanner.nextInt();
14+
while (n > 0) {
15+
int m = n % 10;
16+
r = r * 10 + m;
17+
n /= 10;
18+
19+
}
20+
System.out.print("N sonini Chapdan O`nga Qarab O`qilishi: "+r);
21+
22+
}
23+
}

src/whileGita/while19.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package whileGita;
2+
3+
import java.util.Scanner;
4+
5+
public class while19 {
6+
public static void main(String[] args) {
7+
int n;
8+
Scanner scanner=new Scanner(System.in);
9+
10+
System.out.print("N:");
11+
n = scanner.nextInt();
12+
int sum = 0;
13+
int num = 0;
14+
while (n > 0)
15+
{
16+
++num;
17+
sum += n % 10;
18+
n /= 10;
19+
}
20+
System.out.print("Raqamlar soni:");
21+
System.out.print(num);
22+
System.out.print("\n");
23+
System.out.print("Raqamlar yig`indisi:");
24+
System.out.print(sum);
25+
26+
}
27+
}

src/whileGita/while20.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package whileGita;
2+
3+
import java.util.Scanner;
4+
5+
public class while20 {
6+
public static void main(String[] args) {
7+
int n;
8+
Scanner scanner=new Scanner(System.in);
9+
10+
System.out.print("N:");
11+
n = scanner.nextInt();
12+
while ((n > 0) & ((n % 10) != 2))
13+
{
14+
n /= 10;
15+
}
16+
if ((n > 0) && (n % 10) == 2)
17+
{
18+
System.out.print("2 raqami Bor");
19+
}
20+
else
21+
{
22+
System.out.print("2 raqami Yo`q");
23+
}
24+
}
25+
}

src/whileGita/while21.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package whileGita;
2+
3+
import java.util.Scanner;
4+
5+
public class while21 {
6+
public static void main(String[] args) {
7+
8+
Scanner scanner=new Scanner(System.in);
9+
10+
int n;
11+
System.out.print("N:");
12+
n = scanner.nextInt();
13+
while ((n > 0) & ((n % 10) % 2 == 0))
14+
{
15+
n /= 10;
16+
}
17+
if ((n % 10) % 2 != 0)
18+
{
19+
System.out.print("Toq sonlar Bor !");
20+
}
21+
else
22+
{
23+
System.out.print("Toq sonlar Yo`q !");
24+
}
25+
26+
}
27+
}

src/whileGita/while23.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package whileGita;
2+
3+
import java.util.Scanner;
4+
5+
public class while23 {
6+
public static void main(String[] args) {
7+
Scanner scanner=new Scanner(System.in);
8+
9+
int a;
10+
int b;
11+
System.out.print("A:");
12+
a = scanner.nextInt();
13+
System.out.print("B:");
14+
b = scanner.nextInt();
15+
while ((a != 0) & (b != 0))
16+
{
17+
if (a > b)
18+
{
19+
a = a % b;
20+
}
21+
else
22+
{
23+
b = b % a;
24+
}
25+
}
26+
System.out.print(a + b);
27+
28+
}
29+
}

src/whileGita/while25.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package whileGita;
2+
3+
import java.util.Scanner;
4+
5+
public class while25 {
6+
public static void main(String[] args) {
7+
Scanner scanner=new Scanner(System.in);
8+
9+
int n;
10+
System.out.print("N:");
11+
n = scanner.nextInt();
12+
13+
int f1 = 1;
14+
int f2 = 1;
15+
int f = 0;
16+
17+
while (f < n + 1)
18+
{
19+
f = f2 + f1;
20+
f2 = f1;
21+
f1 = f;
22+
}
23+
System.out.print(f);
24+
25+
}
26+
}

src/whileGita/while26.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package whileGita;
2+
3+
import java.util.Scanner;
4+
5+
public class while26 {
6+
public static void main(String[] args) {
7+
int n;
8+
Scanner scanner=new Scanner(System.in);
9+
10+
System.out.print("N:");
11+
n = scanner.nextInt();
12+
13+
int f1 = 1;
14+
int f2 = 1;
15+
int f = 0;
16+
17+
while (f < n)
18+
{
19+
f = f2 + f1;
20+
f2 = f1;
21+
f1 = f;
22+
}
23+
System.out.print("F_k - 1 =");
24+
System.out.print(f2);
25+
System.out.print("\n");
26+
System.out.print("F_k+1=");
27+
System.out.print(f1 + f2);
28+
29+
}
30+
}

src/whileGita/while27.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package whileGita;
2+
3+
import java.util.Scanner;
4+
5+
public class while27 {
6+
public static void main(String[] args) {
7+
Scanner scanner = new Scanner(System.in);
8+
int n;
9+
System.out.print("N:");
10+
n = scanner.nextInt();
11+
int f1 = 1;
12+
int f2 = 1;
13+
int f = 0;
14+
int k = 2;
15+
while (f < n)
16+
{
17+
++k;
18+
f = f2 + f1;
19+
f2 = f1;
20+
f1 = f;
21+
}
22+
System.out.print("k:");
23+
System.out.print(k);
24+
}
25+
}

0 commit comments

Comments
 (0)