/* File: powers.c This program prints out some powers of 2. */ #include #include "genlib.h" #include "simpio.h" main() { int i, limit, n ; printf("This program prints out the powers of 2.\n") ; printf("How many entries? "); limit = GetInteger() ; n = 1 ; for (i = 0 ; i <= limit ; i++) { printf("2 raised to %d = %d\n", i, n) ; n = 2 * n ; } }