Skip to content

Commit d81f6e1

Browse files
author
Hud
committed
GITA MASALA
1 parent 500cb1e commit d81f6e1

File tree

7 files changed

+306
-25
lines changed

7 files changed

+306
-25
lines changed

.idea/dbnavigator.xml

Lines changed: 184 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
295 Bytes
Binary file not shown.

src/fori/for27.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@
44

55
public class for27 {
66
public static void main(String[] args) {
7-
Scanner scanner=new Scanner(System.in);
8-
double X;
9-
System.out.print("Raqamni kiriting X (|X|<1): ");
10-
X = scanner.nextDouble();
11-
int N;
12-
System.out.print("Raqamni kiriting N (>0): ");
13-
N = scanner.nextInt();
14-
double answer;
15-
double z; //
16-
double h;
17-
double stepen;
18-
z = stepen = 1;
19-
h = X;
20-
answer = X;
21-
for (int i = 1; i <= N ;i++)
22-
{
23-
h = h * X * X; // x^3 / x^5 /x^7
24-
stepen = stepen * (2 * i - 1); // stepen= 1 / 3 / 15
25-
z = z * (i * 2 + 1) * (i * 2); // 6 / 40
26-
answer += (stepen * h) / z; // (1*x^3)/6
27-
z = z / (i * 2 + 1); // 2 / 8x
7+
Scanner scanner = new Scanner(System.in);
8+
9+
10+
float a;
11+
float min = Integer.MAX_VALUE;
12+
float minnum = 0;
13+
float max = 0;
14+
int n;
15+
System.out.print("N:");
16+
n = scanner.nextInt();
17+
for (int i = 1; i <= n; ++i) {
18+
System.out.print(i + "-");
19+
a = scanner.nextInt();
20+
21+
if ( (a < min)) {
22+
min = a;
23+
minnum = i;
24+
}
25+
26+
2827
}
29-
System.out.printf("Javob: %.2f",answer);
28+
System.out.println("Element Raqami:"+minnum);
29+
System.out.println("Eng kichik son: "+min);
3030

3131

3232
}

src/whileGita/While28.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package whileGita;
2+
3+
public class While28 {
4+
5+
public static void main(String[] args) {
6+
solution(0.1); // 2
7+
}
8+
9+
// e = 0.1
10+
public static void solution(double e) {
11+
double a1, ak = 2;
12+
int k = 1; // k -> 2, 3, 4, 5, 6...
13+
do {
14+
a1 = ak; // a1=2.5
15+
k++; // 2
16+
ak = 2 + 1 / a1; // formula orqali ak topiladi
17+
//ak = 2.5, a1=2
18+
} while (!(Math.abs(ak - a1) < e));
19+
20+
System.out.println(k); // 2
21+
22+
}
23+
}

src/whileGita/While29.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package whileGita;
2+
3+
public class While29 {
4+
5+
public static void main(String[] args) {
6+
solution(0.1); // 2
7+
}
8+
9+
// e = 0.1
10+
public static void solution(double e) {
11+
double a1, a2 = 1, ak = 2;
12+
int k = 2; // k -> 2, 3, 4, 5, 6...
13+
do {
14+
a1 = a2; // a1 = 1.666
15+
a2 = ak; // a2 = 1.8666
16+
k++; // 3
17+
ak = (a1 + 2 * a2) / 3; // formula orqali ak topiladi
18+
//k=3 ak = 5/3=1.666
19+
//k=3 ak = 5/3=1.666
20+
} while (!(Math.abs(ak - a1) < e)); //1.8-1.666
21+
22+
System.out.println(k); // 2
23+
24+
}
25+
}

src/whileGita/while16.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package whileGita;
2+
3+
public class while16 {
4+
public static void main(String[] args) {
5+
solution(5);
6+
}
7+
public static void solution( int p) {
8+
int k = 1;
9+
float d = 10F;
10+
float s = 10F;
11+
while (s <= 200F)
12+
{
13+
++k;
14+
d += d * p / 100;
15+
s += d;
16+
}
17+
System.out.print("Kunlar Soni:");
18+
System.out.print(k);
19+
System.out.print("\n");
20+
System.out.print("Masofa:");
21+
System.out.print(s);
22+
}
23+
24+
}

src/whileGita/while17.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package whileGita;
2+
3+
import java.util.Scanner;
4+
5+
public class while17 {
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("Num:");
21+
System.out.print(num);
22+
System.out.print("\n");
23+
System.out.print("Sum:");
24+
System.out.print(sum);
25+
}
26+
27+
}
28+

0 commit comments

Comments
 (0)