Skip to content

Commit 7cb0a57

Browse files
Irani-LaptopIrani-Laptop
Irani-Laptop
authored and
Irani-Laptop
committed
first time
1 parent 95af1b3 commit 7cb0a57

12 files changed

+275
-0
lines changed

P25P30/.classpath

+10
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>

P25P30/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

P25P30/.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>P25P30</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 numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
eclipse.preferences.version=1
2+
encoding//src/P29.java=UTF-8
3+
encoding//src/P30.java=UTF-8
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

P25P30/src/P25.java

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import java.util.Scanner;
2+
3+
public class P25 {
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 p=1;
13+
for (int x=1;x<=n;x++)
14+
p=p*x;
15+
16+
17+
System.out.println(n + "! = " + p);
18+
19+
20+
}// end of Main
21+
}// end of Class

P25P30/src/P26.java

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import java.util.Scanner;
2+
3+
public class P26 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
int n=0;
9+
10+
11+
int sum=0;
12+
for (int x=1;x<=10;x++)
13+
{
14+
n=input.nextInt();
15+
16+
//Calc
17+
18+
sum = sum + n;
19+
}
20+
21+
System.out.println("Sum is: " + sum);
22+
System.out.println("Avg is: " + sum/10.0);
23+
24+
25+
}// end of Main
26+
}// end of Class

P25P30/src/P27.java

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import java.util.Scanner;
2+
3+
public class P27 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
int n=0;
9+
10+
System.out.println("enter number (" + 1 + ") : ");
11+
int min = input.nextInt();
12+
for (int x=2;x<=100;x++)
13+
{
14+
System.out.println("enter number(" + x + ") : ");
15+
n=input.nextInt();
16+
17+
//Calc
18+
if (n<min)
19+
min=n;
20+
}
21+
22+
System.out.println("Min is: " + min);
23+
24+
}// end of Main
25+
}// end of Class

P25P30/src/P28.java

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import java.util.Scanner;
2+
3+
public class P28 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
int n=0;
9+
10+
System.out.println("enter number (" + 1 + ") : ");
11+
int max = input.nextInt();
12+
for (int x=2;x<=100;x++)
13+
{
14+
System.out.println("enter number(" + x + ") : ");
15+
n=input.nextInt();
16+
17+
//Calc
18+
if (n>max)
19+
max=n;
20+
}
21+
22+
System.out.println("Max is: " + max);
23+
24+
}// end of Main
25+
}// end of Class

P25P30/src/P28a.java

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import java.util.Scanner;
2+
3+
public class P28a {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
int n=0;
9+
10+
System.out.println("enter number (" + 1 + ") : ");
11+
int max = input.nextInt();
12+
int min = max;
13+
14+
15+
for (int x=2;x<=5;x++)
16+
{
17+
System.out.println("enter number(" + x + ") : ");
18+
n=input.nextInt();
19+
20+
//Calc
21+
if (n>max)
22+
max=n;
23+
if (n<min)
24+
min=n;
25+
}
26+
27+
System.out.println("Max is: " + max);
28+
System.out.println("Min is: " + min);
29+
30+
}// end of Main
31+
}// end of Class

P25P30/src/P29.java

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import java.util.Scanner;
2+
3+
public class P29 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
int n=0;
9+
int min1=0; //اولین کمترین
10+
int min2=0; // دومین کمترین
11+
12+
System.out.println("enter number(" + 1 + ") : ");
13+
int n1=input.nextInt();
14+
System.out.println("enter number(" + 2 + ") : ");
15+
int n2=input.nextInt();
16+
17+
if (n1<n2)
18+
{
19+
min1 = n1;
20+
min2 = n2;
21+
}
22+
else
23+
{
24+
min1 = n2;
25+
min2 = n1;
26+
}
27+
28+
29+
30+
for (int x=3;x<=6;x++)
31+
{
32+
System.out.println("enter number(" + x + ") : ");
33+
n=input.nextInt();
34+
35+
//Calc
36+
37+
if (n>min1 && n<min2)
38+
min2=n;
39+
if (n<min1)
40+
{
41+
min2=min1;
42+
min1=n;
43+
}
44+
}// end of for
45+
46+
System.out.println("Min 1 is: " + min1);
47+
System.out.println("Min 2 is: " + min2);
48+
49+
50+
}// end of Main
51+
}// end of Class

P25P30/src/P30.java

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import java.util.Scanner;
2+
3+
public class P30 {
4+
5+
public static void main(String[] args)
6+
{
7+
Scanner input=new Scanner (System.in);
8+
int n=0;
9+
int max1=0; //اولین کمترین
10+
int max2=0; // دومین کمترین
11+
12+
System.out.println("enter number(" + 1 + ") : ");
13+
int n1=input.nextInt();
14+
System.out.println("enter number(" + 2 + ") : ");
15+
int n2=input.nextInt();
16+
17+
if (n1<n2)
18+
{
19+
max1 = n2;
20+
max2 = n1;
21+
}
22+
else
23+
{
24+
max1 = n1;
25+
max2 = n2;
26+
}
27+
28+
29+
30+
for (int x=3;x<=6;x++)
31+
{
32+
System.out.println("enter number(" + x + ") : ");
33+
n=input.nextInt();
34+
35+
//Calc
36+
37+
if (n<max1 && n>max2)
38+
max2=n;
39+
if (n>max1)
40+
{
41+
max2=max1;
42+
max1=n;
43+
}
44+
}// end of for
45+
46+
System.out.println("Max 1 is: " + max1);
47+
System.out.println("Max 2 is: " + max2);
48+
49+
50+
}// end of Main
51+
}// end of Class

0 commit comments

Comments
 (0)