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 () ;
    }

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|