Skip to content

Commit 85f2440

Browse files
Irani-LaptopIrani-Laptop
Irani-Laptop
authored and
Irani-Laptop
committed
first time
1 parent 0d3292c commit 85f2440

File tree

8 files changed

+205
-0
lines changed

8 files changed

+205
-0
lines changed

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

P87P89/.gitignore

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

P87P89/.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>P87P89</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,4 @@
1+
eclipse.preferences.version=1
2+
encoding//src/P871.java=UTF-8
3+
encoding//src/P88.java=UTF-8
4+
encoding//src/P89.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

P87P89/src/P871.java

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* P87 : تبدیل یک عدد از مبنای 2 به مبنای 8 روش مستقیم
3+
*
4+
* @author Gholamali Nejad Hajali Irani
5+
* @version 1.0
6+
* @since 2021/02/05
7+
* @Team gClassAcademy
8+
* @Website youtube.com/gClassAcademy
9+
*
10+
*/
11+
12+
import java.util.Scanner;
13+
14+
public class P871
15+
{
16+
public static void main(String[] args)
17+
{
18+
Scanner input=new Scanner (System.in);
19+
20+
System.out.print("Enter n: ");
21+
long n = input.nextLong(); // برای عدد گرفته شده از کاربر
22+
System.out.println(n);
23+
24+
25+
long p=1;
26+
long sum = 0;
27+
while (n>0)
28+
{
29+
long r = n%1000;
30+
long k = r%10 + (((r/10)%10) *2) + ((r/100) *4);
31+
32+
sum = sum + p * k;
33+
p=p*10;
34+
35+
n = n/1000;
36+
}
37+
38+
System.out.println(sum);
39+
40+
41+
42+
43+
}// end of main
44+
}// end of class
45+
46+
47+
48+
49+
50+
51+
52+
53+

P87P89/src/P88.java

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* P88 : تبدیل یک عدد از مبنای 10 به مبنای 16 روش رشته ای
3+
*
4+
* @author Gholamali Nejad Hajali Irani
5+
* @version 1.0
6+
* @since 2021/02/05
7+
* @Team gClassAcademy
8+
* @Website youtube.com/gClassAcademy
9+
*
10+
*/
11+
12+
import java.util.Scanner;
13+
14+
public class P88
15+
{
16+
public static void main(String[] args)
17+
{
18+
Scanner input=new Scanner (System.in);
19+
20+
System.out.print("Enter n: ");
21+
long n = input.nextLong(); // برای عدد گرفته شده از کاربر
22+
23+
String s=""; // برای حاصل جمع نهایی
24+
while (n>0)
25+
{
26+
long r = n % 16;
27+
28+
if (r<10)
29+
s = r + s;
30+
else
31+
s = (char)(r+55) + s;
32+
33+
n = n/16;
34+
}
35+
36+
System.out.println(s);
37+
38+
39+
40+
41+
42+
}// end of main
43+
}// end of class
44+
45+
46+
47+
48+
49+
50+
51+
52+

P87P89/src/P89.java

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
* P89 : تبدیل یک عدد از مبنای 2 به مبنای 16 روش مستقیم
3+
*
4+
* @author Gholamali Nejad Hajali Irani
5+
* @version 1.0
6+
* @since 2021/02/05
7+
* @Team gClassAcademy
8+
* @Website youtube.com/gClassAcademy
9+
*
10+
*/
11+
12+
import java.util.Scanner;
13+
14+
public class P89
15+
{
16+
public static void main(String[] args)
17+
{
18+
Scanner input=new Scanner (System.in);
19+
20+
System.out.print("Enter n: ");
21+
long n = input.nextLong(); // برای عدد گرفته شده از کاربر
22+
//System.out.println(n);
23+
24+
25+
String sum = "";
26+
while (n>0)
27+
{
28+
long r = n%10000;
29+
long k = r%10 + (((r/10)%10) *2) + ((r/100)%10 *4) + (r/1000)*8;
30+
31+
if (k<10)
32+
sum = k + sum;
33+
else
34+
sum = (char)(k+55) + sum;
35+
36+
n = n/10000;
37+
}
38+
39+
System.out.println(sum);
40+
41+
42+
43+
44+
}// end of main
45+
}// end of class
46+
47+
48+
49+
50+
51+
52+
53+
54+

0 commit comments

Comments
 (0)