C program that determine if a number is a power of 2
Posted by Samath
Last Updated: June 03, 2015

Write a C program that reads from the console a random number and determine if it is a power of 2.


#include <stdio.h>
int main(int argc, char *argv[])
	int i;

	printf("Please enter a number\n");
	scanf("%d", &i);

		printf("The number is a power of 2\n");
		printf("The number is NOT a power of 2\n");

	return 0;