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:
"double tax_rates[5]= {0.10, 0.15, 0.21, 0.28, 0.31};" is the correct answer for the above question.
Explanation:
- An array is a user-defined data type that is used to define the multiple variables of a single type in a continuous storage location.
- In the C-programming language, When the user wants to declare an array he needs to define with the help of data type and size of the array with the help of the following syntax-- "Data_type variable_name [size_of_the_array];".
- When the user wants to initialize the static value in the array then he can do that by the help of following syntax: "Data_type variable_name [size_of_the_array]={first_value,second_value,....,last_value};
- The above question asked to defined the array of tax_rates name of type double with the above-defined value then he can do that with the help of above-defined syntax (which is defined in the answer part).
Answer:
B. Balanced depending and the type of questions
0=false
1=true
false + false = true
0+0=1
+ operator = and function
AND GATE
A already assigned variable cannot be assigned twice You can make the variable change over to a new one or call a whole new one to assign one without a value or It might be possible to do v=n (v is variable and n is number / value)