#include #include #define MAXLINE 80 int test (unsigned int n) { /* Replace this with an accurate test. This one is too negative. */ return 0; } char prompt ( ) { printf ("> "); return getchar ( ); } int main ( ) { char in[MAXLINE]; unsigned int n; char c; int i; c = prompt(); while (c != EOF) { i = 0; while (c != '\n') { in[i++] = c; c = getchar(); } in[i] = '\0'; n = atoi (in); if (test (n)) printf ("%u is a power of 2\n", n); else printf ("%u is not a power of 2\n", n); c = prompt(); } }