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