C Programming :: Basic Concepts - Discussion
Home > C Programming > Basic Concepts > MCQs Questions Discussion
25 / 90
What is the output of the following 'C' program ?
#include<stdio.h>
void main()
{
unsigned int num;
int c = 0;
scanf("%u", &num);
for(; num; num >>=1)
{
if(num & 1)
c++;
printf ("%d", c);
}
}
#include<stdio.h>
void main()
{
unsigned int num;
int c = 0;
scanf("%u", &num);
for(; num; num >>=1)
{
if(num & 1)
c++;
printf ("%d", c);
}
}
AIt counts the number of bits which are on in the number num
BIt sets all bits in the number num to 1
CIt sets bits in the number num to 0
DNone of these
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
No Discussion on this question yet!