Skip to content
Sign upLog in
Profile icon

bvernon2

@bvernon2
Repls
Community
bvernon2
bvernon2
shared a Post
4 years ago
4
sqrt function not defined in the math.h header?
working a Lab for class including the math.h function but it gives an error when using the sqrt function. the code runs fine in other online compiler
PedroGomes31
PedroGomes31
im having the same issue, #include #include int main(void) { float x1=0.0,x2=0.0,a,b,c,delta=0.0,Rdelta=0.0; printf("a:"); scanf("%f",&a); printf("b:"); scanf("%f",&b); printf("c:"); scanf("%f",&c); delta=(powf(b,2))-4ac; printf("delta:%lf",delta); Rdelta=(powf(delta,0.5)); x1=(-b-Rdelta)/2*a; x2=(-b+Rdelta)/2*a; printf("x1:%f",x1); printf("x2:%f",x2); return 0; } in my code you can change 'Rdelta=(powf(delta,0.5));' for 'Rdelta=(sqrtf(delta));' and it still 5 months ago
camiloalmendra1
camiloalmendra1
So, math.h functions are not available in Replit?6 months ago
Geocube101
Geocube101
I don't know why it doesn't work, but try removing the sqrt() and replace it with the value to 0.5 power sqrt(x) equals x^0.54 years ago