import java.util.Scanner;
public class OctaltoAll {
public static void main(String[] args) {
Scanner myScanner=new Scanner(System.in);
System.out.print("Enter a octal number : ");
String str=myScanner.nextLine();
int num=Integer.parseInt(str,8);
String decimal=Integer.toString(num);
String binary=Integer.toBinaryString(num);
String hexa=Integer.toHexString(num);
System.out.println("Decimal value is : " +decimal);
System.out.println("Binary value is : " +binary);
System.out.println("Hexadeciaml value is : " +hexa);
}
}
//Enter a octal number : 345
//Decimal value is : 229
//Binary value is : 11100101
//Hexadeciaml value is : e5
public class OctaltoAll {
public static void main(String[] args) {
Scanner myScanner=new Scanner(System.in);
System.out.print("Enter a octal number : ");
String str=myScanner.nextLine();
int num=Integer.parseInt(str,8);
String decimal=Integer.toString(num);
String binary=Integer.toBinaryString(num);
String hexa=Integer.toHexString(num);
System.out.println("Decimal value is : " +decimal);
System.out.println("Binary value is : " +binary);
System.out.println("Hexadeciaml value is : " +hexa);
}
}
//Enter a octal number : 345
//Decimal value is : 229
//Binary value is : 11100101
//Hexadeciaml value is : e5
No comments:
Post a Comment