Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 985db6c

Browse files
Irani-LaptopIrani-Laptop
Irani-Laptop
authored and
Irani-Laptop
committed
first time
1 parent 0657893 commit 985db6c

File tree

6 files changed

+96
-0
lines changed

6 files changed

+96
-0
lines changed

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

P50/.gitignore

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

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

P50/src/P50.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* P50 : 50 امین عدد اول
3+
*
4+
* @author Gholamali Nejad Hajali Irani
5+
* @version 1.0
6+
* @since 2021/01/02
7+
* @Team gClassAcademy
8+
* @Website https://www.youtube.com/c/gClassAcademy
9+
*/
10+
11+
import java.util.Scanner;
12+
13+
public class P50
14+
{
15+
public static void main(String[] args)
16+
{
17+
Scanner input=new Scanner (System.in);
18+
19+
20+
int primecount=0; //برای شمارش تعداد اعداد اول
21+
int n=0; //عددی که هر بار اول بودن آنرا بررسی میکنیم
22+
23+
while (primecount<50)
24+
{
25+
n++;
26+
27+
// بررسی اول بودن عدد n
28+
int count=0; //برای تعداد مقسوم علیه ها
29+
for (int x=1;x<=n;x++)
30+
if (n%x==0)
31+
count++;
32+
if (count==2)
33+
{
34+
primecount++;
35+
}
36+
37+
}//end of while primecount
38+
39+
System.out.println(n);
40+
41+
42+
43+
/*
44+
* for (int n=1;n<=100000;n++) { // بررسی اول بودن عدد n int count=0; //برای
45+
* تعداد مقسوم علیه ها for (int x=1;x<=n;x++) if (n%x==0) count++; if (count==2)
46+
* { primecount++; if (primecount==500) { System.out.println(primecount + ":" +
47+
* n); break; } } }// end of for n
48+
*/
49+
50+
51+
}// end of main
52+
}// end of class

0 commit comments

Comments
 (0)