Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions power.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include<stdio.h>

// function prototype declaration
int power(int n1, int n2);

int main()
{
printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");
int base, exp;
printf("Enter base number: ");
scanf("%d", &base);
printf("\n\nEnter Power factor: ");
scanf("%d", &exp);
printf("\n\n\n\t\t\t%d^%d = %d", base, exp, power(base, exp));
printf("\n\n\t\t\tCoding is Fun !\n\n\n");
return 0;
}

int power(int b, int e)
{
if(e == 0)
return 1;

return (b*power(b, e-1));
}