We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 37838f6 commit 61aaa59Copy full SHA for 61aaa59
Conversions/HexToOct.java
@@ -4,7 +4,8 @@
4
import java.util.Scanner;
5
6
public class HexToOct
7
-{
+{
8
+ //Function that takes the Hexadecimal number as input and returns the decimal form.
9
public static int hex2decimal(String s)
10
{
11
String str = "0123456789ABCDEF";
@@ -17,7 +18,8 @@ public static int hex2decimal(String s)
17
18
val = 16*val + n;
19
}
20
return val;
- }
21
+ }
22
+ // Main function that gets the hex input from user and converts it into octal.
23
public static void main(String args[])
24
25
String hexadecnum;
@@ -39,7 +41,7 @@ public static void main(String args[])
39
41
octnum[i++] = decnum%8;
40
42
decnum = decnum/8;
43
-
44
+ //Print the octal form of the number.
45
System.out.print("Equivalent Octal Number is :\n");
46
for(j=i-1; j>0; j--)
47
0 commit comments