הנה השאלה: ובהמשך למטה הCODE שלי... לא ממש הבנתי איך אני קורא לפונקציה בMAIN... בגלל לא מדפיס לי כלום אשמח לדעת איפה לתקן..
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int f(double a,double b,double c,double *x1,double *x2)
{
float dis, y;
dis=((b*b)-(4*a*c));
if (dis<0)
{
return 0;
printf("no");
} else if(dis==0)
{
*x1=-b /(2* a);
return 1;
}
else
{
y = sqrt(dis);
*x1 = (-b+y)/(2*a);
*x2 = (-b+y)/(2*a);
return 2;
}
}
void main()
{
float a, b, c, x1, x2;
printf("Please enter your value for a: ");
scanf("%f", &a);
printf("\nPlease enter your value for b: ");
scanf("%f", &b);
printf("\nPlease enter your value for c: ");
scanf("%f", &c);
f(a,b,c,&x1,&x2);
if (f==0)
{
printf("no res");
}
else if (f==1) printf( "the one res is %f",x1);
else if (f==2) printf( "the one res is %f and res two is %f",x1,x2);
}