Hi everyone,
I am having this problem to define a function which raises a float y eg 3.5 which is not a whole number to the base x.
Heres the code which gives domain error as function pow takes only int values.
//Program to raise a number to power when both are floating nos
#include<stdio.h>
#include<conio.h>
#include<math.h>
void power(float x,float i)
{
float y;
y=pow(x,i);
printf("%d",y);
}
void main()
{
float x,i;
printf("Enter any number");
scanf("%d",&x);
printf("Enter its power");
scanf("%d",&i);
power(x,i);
}
<< moderator edit: added [co[u][/u]de][/co[u][/u]de]
tags >>
I'll be glad if you help me out.
Thanks
:confused: