C Program To Find The Value Of One Number Raised To The Power Of Another
♣ Try it Out ::
#include<stdio.h> #include<conio.h> int Power(int b, int p) { if(p == 0) return(1); else return((Power(b, p-1))*b); } int main() { int BaseNumber, PowerNumber; printf("Enter the base number: "); scanf("%d", &BaseNumber); printf("Enter the power: "); scanf("%d", &PowerNumber); printf("\nResult:\t%d ^ %d = ", BaseNumber, PowerNumber); printf("%d", Power(BaseNumber, PowerNumber)); getch(); return(0); }
♣ Output ::
Enter the base number: 25 Enter the power: 3 Result: 25 ^ 3 = 15625
♣ Downloads ::
Comments
Post a Comment