Skip to content

Commit fdaaa9c

Browse files
Irani-LaptopIrani-Laptop
Irani-Laptop
authored and
Irani-Laptop
committed
first time
1 parent 0b67cb6 commit fdaaa9c

12 files changed

+407
-0
lines changed

P41P60P63/.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>

P41P60P63/.gitignore

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

P41P60P63/.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>P41P60P63</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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
eclipse.preferences.version=1
2+
encoding//src/P41.java=UTF-8
3+
encoding//src/P41a.java=UTF-8
4+
encoding//src/P41b.java=UTF-8
5+
encoding//src/P60.java=UTF-8
6+
encoding//src/P61.java=UTF-8
7+
encoding//src/P62.java=UTF-8
8+
encoding//src/P63.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

P41P60P63/src/P41.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* P41 : سری فیبوناتچی 50 جمله اول
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 P41
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<=50)
29+
{
30+
c=a+b;
31+
System.out.println(count + ": " + c);
32+
33+
a=b;
34+
b=c;
35+
36+
count++;
37+
}
38+
39+
40+
41+
}// end of main
42+
}// end of class

P41P60P63/src/P41a.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* P41a : سری فیبوناتچی کمتر از 1000
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 P41a
14+
{
15+
public static void main(String[] args)
16+
{
17+
Scanner input=new Scanner (System.in);
18+
19+
20+
int a=1; //عدد اول در سری فیبوناچی
21+
int b=1; //عدد دوم در سری فیبوناچی
22+
System.out.println(a);
23+
System.out.println(b);
24+
25+
int c=0; //عدد جمع دوتای قبلی در سری فیبوناچی
26+
27+
while ((a+b)<1000)
28+
{
29+
c=a+b;
30+
System.out.println(c);
31+
32+
a=b;
33+
b=c;
34+
}
35+
36+
37+
38+
}// end of main
39+
}// end of class

P41P60P63/src/P41b.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* P41b : میانگین اعداد سری فیبوناتچی کمتر از 1000
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 P41b
14+
{
15+
public static void main(String[] args)
16+
{
17+
Scanner input=new Scanner (System.in);
18+
19+
20+
int a=1; //عدد اول در سری فیبوناچی
21+
int b=1; //عدد دوم در سری فیبوناچی
22+
System.out.println(a);
23+
System.out.println(b);
24+
25+
int c=0; //عدد جمع دوتای قبلی در سری فیبوناچی
26+
int count=2;
27+
int sum=2;
28+
while ((a+b)<1000)
29+
{
30+
c=a+b;
31+
System.out.println(c);
32+
33+
a=b;
34+
b=c;
35+
36+
count++;
37+
sum=sum+c;
38+
}
39+
40+
System.out.println("Count is: " + count);
41+
System.out.println("Sum is: " + sum);
42+
System.out.println("Avg is: " + 1.0* sum/count);
43+
44+
45+
}// end of main
46+
}// end of class

P41P60P63/src/P60.java

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* P60 : 20 امین عدد اول سری فیبوناچی
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 P60
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+
int primeCount=0; //برای شمارش تعداد اعداد اول
28+
29+
while (primeCount<10)
30+
{
31+
c=a+b;
32+
33+
System.out.print(count + ": " + c);
34+
35+
// بررسی اول بودن c
36+
int cc=0; // برای شمارش تعداد مقسوم علیه های c
37+
for (long x=2;x<=Math.sqrt(c);x++)
38+
if (c%x==0)
39+
{
40+
cc++;
41+
break;
42+
}
43+
44+
if (cc==0)
45+
{
46+
primeCount++;
47+
System.out.print(" is Prime" + primeCount);
48+
49+
}
50+
51+
System.out.println();
52+
a=b;
53+
b=c;
54+
55+
count++;
56+
}
57+
58+
59+
60+
}// end of main
61+
}// end of class

P41P60P63/src/P61.java

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* P61 : 12 امین عدد اول سری فیبوناچی
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 P61
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+
int primeCount=0; //برای شمارش تعداد اعداد اول
28+
29+
while (primeCount<12)
30+
{
31+
c=a+b;
32+
33+
//System.out.print(count + ": " + c);
34+
35+
// بررسی اول بودن c
36+
int cc=0; // برای شمارش تعداد مقسوم علیه های c
37+
for (long x=2;x<=Math.sqrt(c);x++)
38+
if (c%x==0)
39+
{
40+
cc++;
41+
break;
42+
}
43+
44+
if (cc==0)
45+
{
46+
primeCount++;
47+
System.out.print(count + ": " + c);
48+
System.out.print(" is Prime" + primeCount);
49+
System.out.println();
50+
}
51+
52+
a=b;
53+
b=c;
54+
55+
count++;
56+
}
57+
58+
59+
60+
}// end of main
61+
}// end of class

P41P60P63/src/P62.java

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* P62 : تشخیص وجود یک عدد در سری فیبوناچی
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 P62
14+
{
15+
public static void main(String[] args)
16+
{
17+
Scanner input=new Scanner (System.in);
18+
19+
System.out.print("Enter n: ");
20+
int n= input.nextInt(); // عددی که قرار است بررسی شود
21+
22+
23+
24+
// بررسی وجود n در سری فیبوناچی
25+
26+
long a=1; //عدد اول در سری فیبوناچی
27+
long b=1; //عدد دوم در سری فیبوناچی
28+
long c=0; //عدد جمع دوتای قبلی در سری فیبوناچی
29+
int count=3;
30+
while (c<n && n!=1)
31+
{
32+
c=a+b;
33+
System.out.println(count + ": " + c);
34+
a=b;
35+
b=c;
36+
count++;
37+
}
38+
if (c==n || n==1)
39+
System.out.println("yes");
40+
else if (c>n)
41+
System.out.println("no");
42+
43+
44+
45+
46+
}// end of main
47+
}// end of class

0 commit comments

Comments
 (0)