#include
#include
#include
double f(double x, double a, double b, double c)
{
if(a <= x && x <= b) { return (2*(x-a))/((b-a)*(c-a)); } else if( b < x && x <= c) { return 2*(c-x)/((c-b)*(c-a)); } else return 0; } double F(double x, double a, double b, double c) { if(x<=a) return 0; else if( a
return 1;
}
int main()
{
double x,a,b,c;
clrscr();
printf("enter d value of x, a, b & : ");
scanf(" %lf %lf %lf %lf",&x, &a, &b, &c);
printf(" f(%.2f) = %f",x,f(x,a,b,c));
printf(" F(%.2f) = %f",x,F(x,a,b,c));
getch();
return 0;
}
)
By Alka (4501/09)
Comments