0

2.4kviews

Write a program to find value of y using recursive function where y = x$^n$

**1 Answer**

0

2.4kviews

Write a program to find value of y using recursive function where y = x$^n$

2

429views

written 4.2 years ago by |

```
#include<stdio.h>
#include<conio.h>
void main()
{
int n,x,y;
int exponential (int x, int n);
clrscr();
printf("Enter the values of x and n:");
scanf("%d %d",&x,&n);
y=exponential(x,n);
printf("The value of x raise to n is %d",y);
getch();
}
int exponential (int x, int n)
{
if(n==1)
return x;
else
return (x*exponential(x,n-1));
}
```

ADD COMMENT
EDIT

Please log in to add an answer.