mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-10 21:43:15 +08:00
Update OctalToHexadecimal.java
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
**/
|
**/
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class OctalToHexadecimal{
|
public class OctalToHexadecimal {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
+ + * This method converts a Octal number to
|
+ + * This method converts a Octal number to
|
||||||
@ -55,9 +55,9 @@ public static void main ( String args[]) {
|
|||||||
Scanner input = new Scanner(System.in);
|
Scanner input = new Scanner(System.in);
|
||||||
System.out.print("Enter the Octal number: ");
|
System.out.print("Enter the Octal number: ");
|
||||||
String oct = input.next(); //Take octal number as input from user in a string
|
String oct = input.next(); //Take octal number as input from user in a string
|
||||||
int decimal = OctToDec(oct); //Pass the octal number to function and get converted deciaml form
|
int decimal = OctToDec(oct); //Pass the octal number to function and get converted deciaml form
|
||||||
String hex = DecimalToHex(decimal); //Pass the decimla number to function and get converted Hex form of the number
|
String hex = DecimalToHex(decimal); //Pass the decimla number to function and get converted Hex form of the number
|
||||||
System.out.println("The Hexadecimal equivalant is: "+hex);
|
System.out.println("The Hexadecimal equivalant is: "+hex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user