What is a NaN ?

This is a discussion on What is a NaN ? within the C Programming forums, part of the General Programming Boards category; Code: #include<stdio.h> #include<conio.h> #include<math.h> main() { float a,b,c,d,k,x,y; clrscr(); printf("Enetr the values of a,b,c=>"); scanf("%f %f %f",&a,&b,&c); d=((b*b)-(4*a*c)); k=sqrt(d); x= ...

1. What is a NaN ?

Code:
```#include<stdio.h>
#include<conio.h>
#include<math.h>

main()
{
float a,b,c,d,k,x,y;
clrscr();
printf("Enetr the values of a,b,c=>");
scanf("%f %f %f",&a,&b,&c);
d=((b*b)-(4*a*c));
k=sqrt(d);
x= (-b+k)/(2*a);
y= (-b-k)/(2*a);
printf("The quadratic equation is x=%f and y=%f",x,y);
getch();
}```
but after compiling the result is look like this .....why ....

wnter the values of a,b,c=>6 5 4
sqrt" DOMAIN error
The quadratic equation is x=+NAN and y=+NAN

its the program for to find out the result of the qudratic equation

with regards
anupam jamatia

2. That's it. I'm not helping ANYONE from now on if they aren't using CODE TAGS.

Go read the forum guidelines until you figure out how to use code tags. Do not pass GO, do not collect \$200.

Quzah.

3. step 1) Use code tags

step 2) Use a meaningful subject. "Help me" says nothing. Why would you be creating a thread if you didn't need help?

EDIT: Ohhhhh, quzah beat me.

4. Have you actually tried solving [6x2 + 5x + 4 = 0] manually?

Other problems:
int main()
float x = {expression returning double}

5. > sqrt" DOMAIN error
It means don't do square roots on negative numbers. You need to check this before calling sqrt() and print appropriate answers.

6. NaN means Not a Number.
Have a nice day.