Q. Write a program that reads a positive integer and then finds the smallest power of 2 that is greater than or equal to the number that was read. For example, if the program reads the value of 25, it should note that 32 = 2^5 is the smallest power of two greater than or equal to 25.
My approach:
**
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num1, n;
int num2 = 2^n;
printf("Please type in num1: ");
scanf("%d", &num1);
n = 0;
while (num1 > num2)
{
n=n+1;
}
printf("The power value is %d", n);
return (0);
}
** I am still a beginner so......