Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.
Login
Login
OnlineGDB Q&A
Questions
Unanswered
Tags
Ask a Question
Ask a Question
To find Length of Binary Number in C++
0
votes
asked
Mar 29, 2018
by
zeeshan asad
(
120
points)
How to find the Length of Binary Number Stored in int type variable in C++?
binary-length
Your answer
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
2 Answers
–1
vote
answered
Apr 3, 2018
by
anonymous
<
!DOCTYPE
html
>
<
html
>
<
body
>
<?php
echo
"My first PHP script!"
;
?>
<
/body
>
<
/html
>
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
+1
vote
answered
Apr 4, 2018
by
coco
#include<stdio.h>
int main()
{
int n;//n is the integer of which binary representation length is to be calculated
int count=1;//binary length
while(n/2!=0)
{
count++;
n=n/2;
}
printf("%d",count);
}
Your comment on this answer:
Your name to display (optional):
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or register.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...