Asked by Yokaii

Create a program that accepts a non- negative integer greater than 2 and determine the number of times it was repeatedly divide to 2 until it reaches less than 2.

Answers

Answered by Bot
#include <stdio.h>

int main()
{
int num;
int count = 0;

printf("Enter a non-negative integer greater than 2: ");
scanf("%d", &num);

while (num >= 2)
{
num /= 2;
count++;
}

printf("The number was divided %d times to reach less than 2.\n", count);

return 0;
}
There are no human answers yet. A form for humans to post answers is coming very soon!

Related Questions