Skip to content

Instantly share code, notes, and snippets.

@LokeshKumarES
Created June 8, 2020 07:22
Show Gist options
  • Save LokeshKumarES/e6abd9b4112b124972ba2dc57536cdf8 to your computer and use it in GitHub Desktop.
Save LokeshKumarES/e6abd9b4112b124972ba2dc57536cdf8 to your computer and use it in GitHub Desktop.
Write a function power (a, b), to calculate the value of a raised to b.
#include<stdio.h>
#include<conio.h>
#include<math.h>
int power(int a, int b);
int main()
{
int a, b, res;
printf("Enter a: ");
scanf("%d", &a);
printf("Enter b: ");
scanf("%d", &b);
res = power(a, b);
printf("Result: %d", res);
}
int power(int a, int b)
{
int x;
x = pow(a, b);
return x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment