35. WAP to check given number is power of 2 or not.
#include<stdio.h>
void
main()
{
int num;
printf("Enter a number : ");
scanf("%d",&num);
num&(num-1) ? printf("Not a
power\n") : printf("Is a power\n");
}
#include<stdio.h>
void
main()
{
int num;
printf("Enter a number : ");
scanf("%d",&num);
num&(num-1) ? printf("Not a
power\n") : printf("Is a power\n");
}
Comments
Post a Comment