Answer:
Following are the code to this question:
def binarynumber(num):#defining a method binarynumber that accepts a parameter num
x=""#defining a string variable x
if (num!=0):#defining if condition to check number not equal to 0
while (num>=1):#defining a loop that check value is grater then equal to one
if (num %2==0):#defining if condition to check num is even
x=x+"0" #add string value 0 in num variable
num=num/2 #divide the value by 2
else:#defining else block
x=x+"1"#add string value 1 in num variable
num=(num-1)/2#first subtract 1 into num variable then divide the value by 2
else:
x="0"#assign string value 0 in num variable
return "".join(reversed(x))#return value
num = int (input ("Enter any number: "))#defining num variable that input the integer value
print (binarynumber(num))#using print method to call method binarynumber with passing num parameter
Output:
Enter any number: 12
1100
Explanation:
- In the above python code a method "binarynumber" is declared, in which the "num" variable passes as the parameter inside the method a string variable "x" is declared that stores all converted values.
- Inside the method and if the block is declared that checks number value is not equal to 0 if this condition is false then it will add string value and reverse its value.
- Or if the condition is true it defines a while loop that calculates the given number binary digits and returns its value.
- At the last step, the num variable is declared that inputs the integer value from the user end and calls the method by using the print method.
Answer:
canvas
Explanation:
The answer to this question is that A UI text element must be added to a canvas. The canvas is that area that all the unity items (UI) have to be inside.
We insert the Text UI element when we move to the hierarchy of the scene from create we move to UI and then to text.
After all these have been done, we will get a text element which have been added in the Canvas region.
Well, it's called Central Processing Unit, or CPU.
Answer:
It throws an error.
the public class needs a name.
like this:
public class G{ public static void main(String[] args) {
int x=5 , y = 10;
if (x>5 && y>=2) System.out.println("Class 1");
else if (x<14 || y>5) System.out.println(" Class 2");
else System.out.println(" Class 3"); }// end of main
}
if you give the class a name and format it, you get:
Class 2
Explanation:
Answer:
The answer is D.
Explanation:
because the other answers doesn't make sense.