hiw to check binary number
Answers
Answered by
31
Hello Dear ✔️✔️↙️↙️
Q) How to check Binary Number
✍️ Logic Used To Find Out Whether The Given Number Is Binary Or Not : We check each and every digit of a given number. If any digit is greater than 1, then the given number is not a binary number. In this program, we use two simple operators – % and /, to extract the digits from the given number.
I hope it's helps you Mark as Brainliest answer And heart♥️the Answer...
Answered by
2
Answer:
we need to check each digit for the given number. A binary number means which consists of 0's and 1's.
...
To check so you can use this function:
bool ifBinary(num){
int j = 0;
while(num>0)
{
j=num%10;
if((j!= 0)&&(j!= 1))
{
return(false);
Explanation:
Similar questions