File tree Expand file tree Collapse file tree 3 files changed +54
-4
lines changed
Expand file tree Collapse file tree 3 files changed +54
-4
lines changed Original file line number Diff line number Diff line change 1-
2-
31import java .util .Scanner ;
42
53public class If_else_ladder {
@@ -8,9 +6,9 @@ public static void main(String[] args) {
86
97 // if-else-if ladder Statement
108 try (Scanner scanner = new Scanner (System .in )) {
11-
9+
1210 long grade = scanner .nextLong ();
13-
11+
1412 if (grade >= 90 )
1513
1614 System .out .println ("A++" );
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <projectDescription >
3+ <name >java_digital_number</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 number Diff line number Diff line change 1+
2+
3+ public class NumberSystem {
4+
5+ public static void main (String [] args ) {
6+
7+ String binary = "1000" ;
8+
9+ // binary String and Redix
10+ // Here Take Redix = 2 so String is Consider as Binary Number
11+ System .out .println (Integer .parseInt (binary , 2 )); // Binary to Decimal
12+
13+ String octal = "0007" ;
14+ System .out .println (Integer .parseInt (octal , 8 )); // Octal to Decimal
15+
16+ String hexaDecimal = "FFFF" ;
17+ System .out .println (Integer .parseInt (hexaDecimal , 16 )); // HexaDecimal to Decimal
18+
19+ int decimal = 11 ;
20+ System .out .println (Integer .toBinaryString (decimal )); // Decimal to Binary
21+
22+ int decimalToOctal = 20 ;
23+ System .out .println (Integer .toOctalString (decimalToOctal )); // Decimal to Octal
24+
25+ int decimalToHex = 26 ;
26+ System .out .println (Integer .toHexString (decimalToHex )); // Decimal to HexaDecimal
27+ }
28+
29+ }
30+ /*
31+ * Redix = 2 : Take as Binary
32+ * Redix = 8 : Take as Octal
33+ * Redix = 16 : Take as HexaDecimal
34+ *
35+ */
You can’t perform that action at this time.
0 commit comments