-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert.java
More file actions
33 lines (33 loc) · 946 Bytes
/
convert.java
File metadata and controls
33 lines (33 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.util.*;
import java.util.Scanner;
public class Convert{
public static void main(String[] args){
Scanner scan;
int num;
void getVal();
{
System.out.println("Decimal to HexaDecimal,Octal and Binary");
scan = new Scanner(System.in);
System.out.println("\nEnter the number :");
num = Integer.parseInt(scan.nextLine());
}
void convert();
{
String hexa = Integer.toHexString(num);
System.out.println("HexaDecimal Value is : " + hexa);
String octal = Integer.toOctalString(num);
System.out.println("Octal Value is : " + octal);
String binary = Integer.toBinaryString(num);
System.out.println("Binary Value is : " + binary);
}
}
class Decimal_Conversion
{
public static void main(String args[])
{
Convert obj = new Convert();
obj.getVal();
obj.convert();
}
}
}