Write a function fnpow() in C to compute xy where x is
float and y is integer. Function will return the result
and takes x, y as arguments.
Answers
Answered by
0
Answer:
/* Write a program to Calculate Power of a number using Function*/
#include<stdio.h>
#include<conio.h>
float fnpow (float,int);
void main()
{
int b;
float a,p;
clrscr();
printf("Enter two numbers");
scanf(%f%d",&a,&b);
p=power(a,b);
printf("\n %f raise to %d =%f,a,b,p);
getch();
}
float fnpow(float x,int y)
{
if(y==0)
return(1);
else
return(x*fnpow (x,y-1));
}
Similar questions