Results 1 to 3 of 3

Thread: Floating Point Number + NAN

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2008
    Posts
    474

    Floating Point Number + NAN

    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);
    }
    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?
    SEE the Image attached for the OUTPUT.
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width