/* title: exponentiation author: aeriqusyairi date: Jan23 2012 */ #include<stdio.h> double integerPower(int, int); int main(){ int a = 0, b = 0; double c = 0; printf("Input base and exponent...\nBase:"); scanf("%d", &a); printf("Exponent:"); scanf("%d", &b); c = integerPower(a, b); printf("The value of %d to the power of %d is %.2lf\n", a, b, c); system("pause"); return 0; } double integerPower(int base, int exponent){ int i; double result = 1; for(i = 1; i <= exponent; i++) result*= base; return result; }
My C Repository
C How to Program
Sweet thanks to my broski Yusuke Fiz for this Deitel book.
You light up my life dude.
Just another personal public repository.
Thursday, March 15, 2012
Exponentiation
Function integerPower( base, exponent ) returns the value of baseexponent
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment