File tree Expand file tree Collapse file tree 6 files changed +145
-0
lines changed Expand file tree Collapse file tree 6 files changed +145
-0
lines changed Original file line number Diff line number Diff line change
1
+ package fori ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ public class for18 {
6
+ public static void main (String [] args ) {
7
+ Scanner scanner =new Scanner (System .in );
8
+ float a ;
9
+ System .out .print ("A:" );
10
+ a = scanner .nextFloat ();
11
+
12
+ int n ;
13
+ System .out .print ("N:" );
14
+ n = scanner .nextInt ();
15
+
16
+
17
+ float counter = 1F ;
18
+ float result = 1F ;
19
+
20
+
21
+ for (int i = 2 ; i <= n ; ++i )
22
+ {
23
+ counter *= -a ;
24
+ result += counter ;
25
+ }
26
+ //
27
+ System .out .println ("Natija" +result );
28
+
29
+ }
30
+ }
Original file line number Diff line number Diff line change
1
+ package fori ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ public class for19 {
6
+ public static void main (String [] args ) {
7
+ Scanner scanner =new Scanner (System .in );
8
+ System .out .println ("n:" );
9
+ int n = scanner .nextInt ();
10
+ int result =1 ;
11
+ for (int i = 1 ; i <=n ; i ++) {//i =1; chunki hamma sonni 0 ga ko`paytirsak 0 chiqadi
12
+
13
+ result *=i ;
14
+ }//1*2*3*4*5..*n-> n=biz kiritgan son
15
+ System .out .printf ("1 dan %d gacha bo`lgan sonlarning Ko`paytmasi: %d" ,n ,result );
16
+ }
17
+ }
Original file line number Diff line number Diff line change
1
+ package fori ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ public class for20 {
6
+ public static void main (String [] args ) {
7
+ Scanner scanner =new Scanner (System .in );
8
+ System .out .println ("n: " );
9
+ int n = scanner .nextInt ();
10
+ int result =0 ;
11
+ for (int i = 0 ; i <= n ; i ++) {
12
+ result +=i ;
13
+ }
14
+ System .out .println ("Qiymat: " +result );
15
+ }
16
+ }
Original file line number Diff line number Diff line change
1
+ package fori ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ public class for21 {
6
+ public static void main (String [] args ) {
7
+ int n ;
8
+ Scanner scanner =new Scanner (System .in );
9
+ System .out .print ("N:" );
10
+ n = scanner .nextInt ();
11
+
12
+
13
+ float n1 = 1F ;
14
+ float result = 1F ;
15
+
16
+
17
+
18
+ for (int i = 1 ; i <= n ; ++i )
19
+ {
20
+ n1 *= (float )i ;
21
+ result += 1 / n1 ;
22
+ }
23
+ System .out .print (result );
24
+
25
+ }
26
+ }
Original file line number Diff line number Diff line change
1
+ package fori ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ public class for22 {
6
+ public static void main (String [] args ) {
7
+ float x ;
8
+ Scanner scanner =new Scanner (System .in );
9
+ System .out .print ("X:" );
10
+ x = scanner .nextFloat ();
11
+
12
+ int n ;
13
+ System .out .print ("N:" );
14
+ n = scanner .nextInt ();
15
+
16
+
17
+ float x1 = 1F ;
18
+ float n1 = 1F ;
19
+ float result = 1.0F ;
20
+
21
+
22
+ for (int i = 1 ; i <= n ; ++i )
23
+ {
24
+ n1 *= (float )i ;
25
+ x1 *= x ;
26
+ result += x1 / n1 ;
27
+ }
28
+ System .out .print (result );
29
+
30
+ }
31
+ }
Original file line number Diff line number Diff line change
1
+ package fori ;
2
+
3
+ import java .util .Scanner ;
4
+
5
+ public class for39 {
6
+ public static void main (String [] args ) {
7
+ int a ;
8
+ Scanner scanner =new Scanner (System .in );
9
+ int b ;
10
+ System .out .print ("A:" );
11
+ a = scanner .nextInt ();
12
+ System .out .print ("B:" );
13
+ b = scanner .nextInt ();
14
+
15
+ //
16
+ for (int i = a ; i <= b ; ++i )
17
+ {
18
+ for (int j = 1 ; j <= i ; ++j )
19
+ {
20
+ System .out .println (i );
21
+ }
22
+ }
23
+
24
+ }
25
+ }
You can’t perform that action at this time.
0 commit comments