Skip to content

Instantly share code, notes, and snippets.

@rizwansoaib
Created January 4, 2018 10:43
Show Gist options
  • Save rizwansoaib/b54625b3dc922f81b1d08123fb39010e to your computer and use it in GitHub Desktop.
Save rizwansoaib/b54625b3dc922f81b1d08123fb39010e to your computer and use it in GitHub Desktop.
Find power in c
#include <stdio.h>
void power(int x,int y)
{
int i=1;
int j=x;
if (y!=0)
{
for(i; i<y; i++)
{
x=j*x;
}
printf("%d",x);
}
if (y==0)
printf("1");
}
void main()
{
int x,y;
printf("Enter base and power e.g. 2^3 , 2 3 \n");
scanf("%d%d",&x,&y);
power(x,y);
}
@rizwansoaib
Copy link
Author

Find power in c languages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment