Created
December 19, 2014 09:57
-
-
Save scratchyourbrain/30b4a85a1bbd9243f7fd to your computer and use it in GitHub Desktop.
C program to Calculate the Power of a Number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int base, exp; | |
long long int value=1; | |
printf("Enter base number and exponent respectively: "); | |
scanf("%d%d", &base, &exp); | |
while (exp!=0) | |
{ | |
value*=base; | |
--exp; | |
} | |
printf("Answer = %d", value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment