/*--------------------------------------------------------------------*/ /* powerunsignedflat.c */ /* Author: Bob Dondero */ /*--------------------------------------------------------------------*/ #include /*--------------------------------------------------------------------*/ static unsigned int uiBase; /* Bad style. */ static unsigned int uiExp; /* Bad style. */ static unsigned int uiPower = 1; /* Bad style. */ static unsigned int uiIndex; /* Bad style. */ /*--------------------------------------------------------------------*/ /* Read a non-negative base and exponent from stdin. Write base raised to the exponent power to stdout. Return 0. */ int main(void) { printf("Enter the base: "); scanf("%u", &uiBase); /* Should validate. */ printf("Enter the exponent: "); scanf("%u", &uiExp); /* Should validate. */ uiIndex = 1; loop1: if (uiIndex > uiExp) goto loopend1; uiPower *= uiBase; uiIndex++; goto loop1; loopend1: printf("%u to the %u power is %u.\n", uiBase, uiExp, uiPower); return 0; }