File tree 14 files changed +343
-0
lines changed
14 files changed +343
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <classpath >
3
+ <classpathentry kind =" con" path =" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11" >
4
+ <attributes >
5
+ <attribute name =" module" value =" true" />
6
+ </attributes >
7
+ </classpathentry >
8
+ <classpathentry kind =" src" path =" src" />
9
+ <classpathentry kind =" output" path =" bin" />
10
+ </classpath >
Original file line number Diff line number Diff line change
1
+ /bin /
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <projectDescription >
3
+ <name >P69P71</name >
4
+ <comment ></comment >
5
+ <projects >
6
+ </projects >
7
+ <buildSpec >
8
+ <buildCommand >
9
+ <name >org.eclipse.jdt.core.javabuilder</name >
10
+ <arguments >
11
+ </arguments >
12
+ </buildCommand >
13
+ </buildSpec >
14
+ <natures >
15
+ <nature >org.eclipse.jdt.core.javanature</nature >
16
+ </natures >
17
+ </projectDescription >
Original file line number Diff line number Diff line change
1
+ eclipse.preferences.version =1
2
+ encoding//src/P69.java =UTF-8
3
+ encoding//src/P70.java =UTF-8
4
+ encoding//src/P71.java =UTF-8
Original file line number Diff line number Diff line change
1
+ eclipse.preferences.version =1
2
+ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode =enabled
3
+ org.eclipse.jdt.core.compiler.codegen.targetPlatform =11
4
+ org.eclipse.jdt.core.compiler.codegen.unusedLocal =preserve
5
+ org.eclipse.jdt.core.compiler.compliance =11
6
+ org.eclipse.jdt.core.compiler.debug.lineNumber =generate
7
+ org.eclipse.jdt.core.compiler.debug.localVariable =generate
8
+ org.eclipse.jdt.core.compiler.debug.sourceFile =generate
9
+ org.eclipse.jdt.core.compiler.problem.assertIdentifier =error
10
+ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures =disabled
11
+ org.eclipse.jdt.core.compiler.problem.enumIdentifier =error
12
+ org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures =warning
13
+ org.eclipse.jdt.core.compiler.release =enabled
14
+ org.eclipse.jdt.core.compiler.source =11
Original file line number Diff line number Diff line change
1
+ /**
2
+ * P69 : چاپ تعداد مقسوم علیه های اول یک عدد
3
+ *
4
+ * @author Gholamali Nejad Hajali Irani
5
+ * @version 1.0
6
+ * @since 2021/01/19
7
+ * @Team gClassAcademy
8
+ * @Website https://www.youtube.com/c/gClassAcademy
9
+ *
10
+ */
11
+
12
+ import java .util .Scanner ;
13
+
14
+ public class P69
15
+ {
16
+ public static void main (String [] args )
17
+ {
18
+ Scanner input =new Scanner (System .in );
19
+
20
+ System .out .println ("Enter n:" );
21
+ int n =input .nextInt (); // عددی که از کاربر گرفته می شود
22
+
23
+
24
+ int allcount =0 ; //تعداد اعداد اول
25
+
26
+ for (int x =1 ;x <=n ;x ++)
27
+ if (n %x ==0 ) // اگر x مقسوم علیه بود
28
+ {
29
+ // بررسی اول بودن x
30
+ int count =0 ;
31
+ for (int y =1 ;y <=x ;y ++)
32
+ if (x %y ==0 )
33
+ count ++;
34
+
35
+ if (count ==2 ) //x اول هست
36
+ {
37
+ System .out .println (x );
38
+ allcount ++;
39
+ }
40
+
41
+ }//end of if n%x==0
42
+
43
+ System .out .println ("Count of Primes is: " + allcount );
44
+
45
+
46
+
47
+ }// end of main
48
+ }// end of class
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * P70 : چاپ جمع مقسوم علیه های اول یک عدد
3
+ *
4
+ * @author Gholamali Nejad Hajali Irani
5
+ * @version 1.0
6
+ * @since 2021/01/19
7
+ * @Team gClassAcademy
8
+ * @Website https://www.youtube.com/c/gClassAcademy
9
+ *
10
+ */
11
+
12
+ import java .util .Scanner ;
13
+
14
+ public class P70
15
+ {
16
+ public static void main (String [] args )
17
+ {
18
+ Scanner input =new Scanner (System .in );
19
+
20
+ System .out .println ("Enter n:" );
21
+ int n =input .nextInt (); // عددی که از کاربر گرفته می شود
22
+
23
+
24
+ int allcount =0 ; //تعداد مقسوم علیه های اول
25
+ int sum =0 ; //جمع مقسوم علیه های اول
26
+
27
+ for (int x =1 ;x <=n ;x ++)
28
+ if (n %x ==0 ) // اگر x مقسوم علیه بود
29
+ {
30
+ // بررسی اول بودن x
31
+ int count =0 ;
32
+ for (int y =1 ;y <=x ;y ++)
33
+ if (x %y ==0 )
34
+ count ++;
35
+
36
+ if (count ==2 ) //x اول هست
37
+ {
38
+ System .out .println (x );
39
+ allcount ++;
40
+ sum +=x ;
41
+ }
42
+
43
+ }//end of if n%x==0
44
+
45
+ System .out .println ("Count of Primes is: " + allcount );
46
+ System .out .println ("Sum of Primes is: " + sum );
47
+
48
+
49
+
50
+ }// end of main
51
+ }// end of class
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
Original file line number Diff line number Diff line change
1
+ /**
2
+ * P71 : چاپ میانگین مقسوم علیه های اول یک عدد
3
+ *
4
+ * @author Gholamali Nejad Hajali Irani
5
+ * @version 1.0
6
+ * @since 2021/01/19
7
+ * @Team gClassAcademy
8
+ * @Website https://www.youtube.com/c/gClassAcademy
9
+ *
10
+ */
11
+
12
+ import java .util .Scanner ;
13
+
14
+ public class P71
15
+ {
16
+ public static void main (String [] args )
17
+ {
18
+ Scanner input =new Scanner (System .in );
19
+
20
+ System .out .println ("Enter n:" );
21
+ int n =input .nextInt (); // عددی که از کاربر گرفته می شود
22
+
23
+
24
+ int allcount =0 ; //تعداد مقسوم علیه های اول
25
+ int sum =0 ; //جمع مقسوم علیه های اول
26
+
27
+ for (int x =1 ;x <=n ;x ++)
28
+ if (n %x ==0 ) // اگر x مقسوم علیه بود
29
+ {
30
+ // بررسی اول بودن x
31
+ int count =0 ;
32
+ for (int y =1 ;y <=x ;y ++)
33
+ if (x %y ==0 )
34
+ count ++;
35
+
36
+ if (count ==2 ) //x اول هست
37
+ {
38
+ System .out .println (x );
39
+ allcount ++;
40
+ sum +=x ;
41
+ }
42
+
43
+ }//end of if n%x==0
44
+
45
+ System .out .println ("Count of Primes is: " + allcount );
46
+ System .out .println ("Sum of Primes is: " + sum );
47
+ if (allcount ==0 )
48
+ System .out .println ("تعداد مقسوم علیه های اول صفر است هااا" );
49
+ else
50
+ System .out .println ("Avg of Primes is: " + 1.0 *sum /allcount );
51
+
52
+
53
+
54
+ }// end of main
55
+ }// end of class
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <classpath >
3
+ <classpathentry kind =" con" path =" org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11" >
4
+ <attributes >
5
+ <attribute name =" module" value =" true" />
6
+ </attributes >
7
+ </classpathentry >
8
+ <classpathentry kind =" src" path =" src" />
9
+ <classpathentry kind =" output" path =" bin" />
10
+ </classpath >
Original file line number Diff line number Diff line change
1
+ /bin /
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <projectDescription >
3
+ <name >P72</name >
4
+ <comment ></comment >
5
+ <projects >
6
+ </projects >
7
+ <buildSpec >
8
+ <buildCommand >
9
+ <name >org.eclipse.jdt.core.javabuilder</name >
10
+ <arguments >
11
+ </arguments >
12
+ </buildCommand >
13
+ </buildSpec >
14
+ <natures >
15
+ <nature >org.eclipse.jdt.core.javanature</nature >
16
+ </natures >
17
+ </projectDescription >
Original file line number Diff line number Diff line change
1
+ eclipse.preferences.version =1
2
+ encoding//src/P72.java =UTF-8
Original file line number Diff line number Diff line change
1
+ eclipse.preferences.version =1
2
+ org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode =enabled
3
+ org.eclipse.jdt.core.compiler.codegen.targetPlatform =11
4
+ org.eclipse.jdt.core.compiler.codegen.unusedLocal =preserve
5
+ org.eclipse.jdt.core.compiler.compliance =11
6
+ org.eclipse.jdt.core.compiler.debug.lineNumber =generate
7
+ org.eclipse.jdt.core.compiler.debug.localVariable =generate
8
+ org.eclipse.jdt.core.compiler.debug.sourceFile =generate
9
+ org.eclipse.jdt.core.compiler.problem.assertIdentifier =error
10
+ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures =disabled
11
+ org.eclipse.jdt.core.compiler.problem.enumIdentifier =error
12
+ org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures =warning
13
+ org.eclipse.jdt.core.compiler.release =enabled
14
+ org.eclipse.jdt.core.compiler.source =11
Original file line number Diff line number Diff line change
1
+ /**
2
+ * P72 : اولین عدد دو رقمی از سری فیبوناچی که با مقلوب خود برابر است
3
+ *
4
+ * @author Gholamali Nejad Hajali Irani
5
+ * @version 1.0
6
+ * @since 2021/01/07
7
+ * @Team gClassAcademy
8
+ * @Website https://www.youtube.com/c/gClassAcademy
9
+ */
10
+
11
+ import java .util .Scanner ;
12
+
13
+ public class P72
14
+ {
15
+ public static void main (String [] args )
16
+ {
17
+ Scanner input =new Scanner (System .in );
18
+
19
+
20
+ long a =1 ; //عدد اول در سری فیبوناچی
21
+ long b =1 ; //عدد دوم در سری فیبوناچی
22
+ //System.out.println("1: " + a);
23
+ //System.out.println("2: " + b);
24
+
25
+ long c =0 ; //عدد جمع دوتای قبلی در سری فیبوناچی
26
+ int count =3 ;
27
+
28
+ while (count <=70 )
29
+ {
30
+ c =a +b ;
31
+
32
+ //System.out.println(count + ": " + c);
33
+
34
+ if (c >=10 && c <=99 )
35
+ {
36
+ //بدست آوردن مقلوب c
37
+ long n =c ;
38
+ long p =0 ;
39
+ while (n >0 )
40
+ {
41
+ long r =n %10 ; //برای رقم یکان
42
+
43
+ // محاسبات روی رقم یکان عدد
44
+ //System.out.print(r);
45
+ p =p *10 +r ;
46
+
47
+ // حذف رقم یکان
48
+ n =n /10 ;
49
+ }// end of while
50
+
51
+
52
+ // چاپ نتیجه
53
+ //System.out.println(p);
54
+
55
+ //بررسی برابری عدد با مقلوب خود
56
+
57
+ if (c ==p )
58
+ System .out .println (count + ": " + c );
59
+
60
+ }
61
+
62
+
63
+ a =b ;
64
+ b =c ;
65
+
66
+ count ++;
67
+ }
68
+
69
+
70
+
71
+ }// end of main
72
+ }// end of class
You can’t perform that action at this time.
0 commit comments