Skip to content

Commit

Permalink
Merge pull request tarunsinghofficial#667 from SurbhiPal972/patch-1
Browse files Browse the repository at this point in the history
Create To find the power of a number using while loop
  • Loading branch information
tarunsinghofficial authored Oct 21, 2020
2 parents 29143d5 + 850b92f commit d6372f8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions To find the power of a number using while loop
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
op#include <stdio.h>
int main() {
int base, exp;
long long result = 1;
printf("Enter a base number: ");
scanf("%d", &base);
printf("Enter an exponent: ");
scanf("%d", &exp);

while (exp != 0) {
result *= base;
--exp;
}
printf("Answer = %lld", result);
return 0;
}

0 comments on commit d6372f8

Please sign in to comment.