/*------------------------------------------------------------------*/ /* powerflat.c */ /* Author: Bob Dondero */ /*------------------------------------------------------------------*/ #include static int iBase; static int iExp; static int iPower = 1; static int iIndex; int main(int argc, char *argv[]) /* Read a non-negative base and exponent from stdin. Write base raised to the exponent power to stdout. */ { printf("Enter the base: "); scanf("%d", &iBase); printf("Enter the exponent: "); scanf("%d", &iExp); iIndex = 1; loop1: if (iIndex > iExp) goto loopend1; iPower *= iBase; iIndex++; goto loop1; loopend1: printf("%d to the %d power is %d.\n", iBase, iExp, iPower); return 0; }