EmbLogic's Blog

power of 2

#include <stdio.h>
int main()
{
int a,i;
printf(“enter a number\n”);
scanf(“%d”, &a);
for (i=0;i<=a;i++)
{
a=a/2;
}
if (a%2==0)
printf(“it is power of 2\n”);
else
printf(“it is not\n”);

return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>