Skip to content

Commit 4f2605a

Browse files
Irani-LaptopIrani-Laptop
Irani-Laptop
authored and
Irani-Laptop
committed
first time
1 parent cea6fe3 commit 4f2605a

14 files changed

+343
-0
lines changed

P69P71/.classpath

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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>

P69P71/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

P69P71/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
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
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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

P69P71/src/P69.java

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+

P69P71/src/P70.java

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+

P69P71/src/P71.java

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+

P72/.classpath

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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>

P72/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

P72/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding//src/P72.java=UTF-8
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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

P72/src/P72.java

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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

0 commit comments

Comments
 (0)