Program to illustrate the fabs( ) function

 
    #include <iostream.h>
    #include <math.h>                      // defines the fabs( ) function
          #include <conio.h>
   
           void main ( )
    {

        float i = -20.56;
        cout.precision(2);
        cout<<" i = "<<i;
        cout<<"\n Absolute value of i = "<<fabs(i);
       
        i = 20.56 ;
        cout<<" i = "<<i;
        cout<<"\n Absolute value of i = "<<fabs(i);

        getch () ;
    }

No comments:

Post a Comment