In the above program, I am calculating the square of float number. But sometimes the number is entered as NAN and sometimes Output is NAN. What is NAN? I am entering floating point number, then y NAN is entered?Code:#include<stdio.h> #include<conio.h> float square(float); void main() { clrscr(); float a,b; printf("ENter a Number"); scanf("%f",&a); printf("Number=%f",a); b=square(a); printf("\nSquare of %f is %f",a,b); getch(); } float square(float x) { float y; y=x*x; return(y); }
SEE the Image attached for the OUTPUT.




Reply With Quote