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

Commit 48e2f4e

Browse files
Irani-LaptopIrani-Laptop
Irani-Laptop
authored and
Irani-Laptop
committed
first time
1 parent c68443e commit 48e2f4e

16 files changed

+346
-0
lines changed

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

P12P22/.gitignore

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

P12P22/.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>P12P22</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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
eclipse.preferences.version=1
2+
encoding//src/P12.java=UTF-8
3+
encoding//src/P13.java=UTF-8
4+
encoding//src/P14.java=UTF-8
5+
encoding//src/P15.java=UTF-8
6+
encoding//src/P16.java=UTF-8
7+
encoding//src/P17.java=UTF-8
8+
encoding//src/P18.java=UTF-8
9+
encoding//src/P19.java=UTF-8
10+
encoding//src/P20.java=UTF-8
11+
encoding//src/P21.java=UTF-8
12+
encoding//src/P22.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

P12P22/src/P12.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import java.util.Scanner;
2+
3+
public class P12 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
9+
System.out.println("Please enter n:");
10+
int n=input.nextInt();
11+
12+
13+
for (int x=1 ; x<=n ; x++)
14+
if (n%x==0) //n بر x بخش پذیر باشد
15+
System.out.println(x);
16+
17+
18+
}
19+
20+
}

P12P22/src/P13.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import java.util.Scanner;
2+
3+
public class P13 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
9+
System.out.println("Please enter n:");
10+
int n=input.nextInt();
11+
12+
13+
// for (int x=1 ; x<=n ; x++)
14+
// if (n%x==0) //n بر x بخش پذیر باشد
15+
// if (x%2==1) //x فرد باشد
16+
// System.out.println(x);
17+
18+
19+
for (int x=1 ; x<=n ; x++)
20+
if ((n%x==0) && (x%2==1)) //n بر x بخش پذیر باشد x فرد باشد
21+
System.out.println(x);
22+
23+
24+
}
25+
26+
}

P12P22/src/P14.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import java.util.Scanner;
2+
3+
public class P14 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
9+
System.out.println("Please enter n:");
10+
int n=input.nextInt();
11+
12+
13+
// for (int x=1 ; x<=n ; x++)
14+
// if (n%x==0) //n بر x بخش پذیر باشد
15+
// if (x%2==0) //x زوج باشد
16+
// System.out.println(x);
17+
18+
19+
for (int x=1 ; x<=n ; x++)
20+
if ((n%x==0) && (x%2==0)) //n بر x بخش پذیر باشد x زوج باشد
21+
System.out.println(x);
22+
23+
24+
}
25+
26+
}

P12P22/src/P15.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import java.util.Scanner;
2+
3+
public class P15 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
9+
System.out.println("Please enter n:");
10+
int n=input.nextInt();
11+
12+
13+
int sum=0;
14+
15+
for (int x=1 ; x<=n ; x++)
16+
if (n%x==0)
17+
{
18+
sum =sum + x;
19+
System.out.println(x);
20+
}
21+
22+
System.out.println("sum is : " + sum);
23+
24+
25+
}
26+
27+
}

P12P22/src/P16.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import java.util.Scanner;
2+
3+
public class P16 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
9+
System.out.println("Please enter n:");
10+
int n=input.nextInt();
11+
12+
13+
int count=0;
14+
15+
for (int x=1 ; x<=n ; x++)
16+
if (n%x==0)
17+
{
18+
System.out.println(x);
19+
count++;
20+
}
21+
22+
System.out.println("Count is : " +count);
23+
24+
25+
}
26+
27+
}

P12P22/src/P17.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import java.util.Scanner;
2+
3+
public class P17 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
9+
System.out.println("Please enter n:");
10+
int n=input.nextInt();
11+
12+
13+
int sum=0;
14+
15+
for (int x=1 ; x<=n ; x++)
16+
if (n%x==0 && x%2==1)
17+
{
18+
System.out.println(x);
19+
sum = sum + x;
20+
}
21+
22+
System.out.println("Count is : " +sum);
23+
24+
25+
}
26+
27+
}

P12P22/src/P18.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import java.util.Scanner;
2+
3+
public class P18 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
9+
System.out.println("Please enter n:");
10+
int n=input.nextInt();
11+
12+
13+
int count=0;
14+
15+
for (int x=1 ; x<=n ; x++)
16+
if (n%x==0 && x%2==1)
17+
{
18+
System.out.println(x);
19+
count = count +1;
20+
}
21+
22+
System.out.println("Count is : " +count);
23+
24+
25+
}
26+
27+
}

P12P22/src/P19.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import java.util.Scanner;
2+
3+
public class P19 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
9+
System.out.println("Please enter n:");
10+
int n=input.nextInt();
11+
12+
13+
int sum=0;
14+
for (int x=1 ; x<=n ; x++)
15+
if (n%x==0 && x%2==0)
16+
{
17+
sum = sum + x;
18+
System.out.println(x);
19+
}
20+
21+
System.out.println("sum is : " + sum);
22+
23+
24+
}
25+
26+
}

P12P22/src/P20.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import java.util.Scanner;
2+
3+
public class P20 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
9+
System.out.println("Please enter n:");
10+
int n=input.nextInt();
11+
12+
13+
int count=0;
14+
for (int x=1 ; x<=n ; x++)
15+
if (n%x==0 && x%2==0)
16+
{
17+
count = count + 1;
18+
System.out.println(x);
19+
}
20+
21+
System.out.println("sum is : " + count);
22+
23+
24+
}
25+
26+
}

P12P22/src/P21.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import java.util.Scanner;
2+
3+
public class P21 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
9+
System.out.println("Please enter n:");
10+
int n=input.nextInt();
11+
12+
int sum=0;
13+
int count=0;
14+
15+
for (int x=1 ; x<=n ; x++)
16+
if (n%x==0)
17+
{
18+
count++;
19+
sum = sum + x;
20+
System.out.println(x);
21+
}
22+
23+
System.out.println("sum is : " + sum);
24+
System.out.println("count is : " + count);
25+
26+
System.out.println("Avg is :" + 1.0 * sum/count);
27+
28+
}
29+
30+
}

P12P22/src/P22.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import java.util.Scanner;
2+
3+
public class P22 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
9+
System.out.println("Please enter n:");
10+
int n=input.nextInt();
11+
12+
int sum=0;
13+
int count=0;
14+
15+
for (int x=1 ; x<=n ; x++)
16+
if (n%x==0 && x%2==0)
17+
{
18+
count++;
19+
sum = sum + x;
20+
System.out.println(x);
21+
}
22+
23+
System.out.println("\nsum is : " + sum);
24+
System.out.println("count is : " + count);
25+
26+
System.out.println("Avg is : " + 1.0 * sum/count);
27+
28+
}
29+
30+
}

0 commit comments

Comments
 (0)