write a program in java to convert a decimal number to binary....
Answers
Answered by
3
class DecimalBinaryExample{
public static void main(String a[]){
System.out.println("Binary representation of 124: ");
System.out.println(Integer.toBinaryString(124));
System.out.println("\nBinary representation of 45: ");
System.out.println(Integer.toBinaryString(45));
System.out.println("\nBinary representation of 999: ");
System.out.println(Integer.toBinaryString(999));
}
}
toplayer:
but i dont knw this method........can u explain me wid scanner of ISR???
Answered by
1
The program output is also shown below.
1. import java.util.Scanner;
2. public class Convert.
3. public static void main(String[] args)
4. int n, count = 0, a;
5. String x = "";
6. Scanner s = new Scanner(System. in);
7. System. out. print("Enter any decimal number:");
8. n = s. nextInt();
I hope this will help you
1. import java.util.Scanner;
2. public class Convert.
3. public static void main(String[] args)
4. int n, count = 0, a;
5. String x = "";
6. Scanner s = new Scanner(System. in);
7. System. out. print("Enter any decimal number:");
8. n = s. nextInt();
I hope this will help you
Similar questions
Accountancy,
8 months ago
Math,
8 months ago
Biology,
1 year ago
Physics,
1 year ago
Social Sciences,
1 year ago
Geography,
1 year ago