#include<stdio.h>
#include<conio.h>
double iteration_power(double,int);
void main()
{
int n;
double x,res;
clrscr();
printf("\n\t Enter x=");
scanf("\n\t %lf",&x);
printf("\n\t Enter n=");
scanf("%d",&n);
res=iteration_power(x,n);
printf("\n\t %lf power%d=%lf",x,n,res);
getch();
}
double iteration_power(double x, int n)
{
int i;
double p=1;
for(i=1;i<=n;i++)
p=p*x;
return(p);
}
#include<conio.h>
double iteration_power(double,int);
void main()
{
int n;
double x,res;
clrscr();
printf("\n\t Enter x=");
scanf("\n\t %lf",&x);
printf("\n\t Enter n=");
scanf("%d",&n);
res=iteration_power(x,n);
printf("\n\t %lf power%d=%lf",x,n,res);
getch();
}
double iteration_power(double x, int n)
{
int i;
double p=1;
for(i=1;i<=n;i++)
p=p*x;
return(p);
}
No comments:
Post a Comment