Answer:
public class IntegerToBinary
{
public static void main(String[] args) {
integerToBinary(6);
}
public static void integerToBinary(int num){
while(num > 0){
System.out.print(num%2);
num = Math.floorDiv(num, 2);
}
}
}
Step-by-step explanation:
*The code is in Java.
Create a function called integerToBinary that takes one parameter, num
Inside the function, create a while loop that iterates while the num is greater than 0. Inside the loop, print the num%2. Then, get the floor division of the num by to and assign it to the num.
Inside the main, call the function with parameter 6.