Pass float to a function : Float : Data Type C# Examples


C# Examples » Data Type » Float »

 

Pass float to a function









    
using  System;

class  MainClass
{
      public  static  void  Main()  {
            float  f  =  6.0F;
            
            float  s  =  Avg(5.0F,  f);
            
            Console.WriteLine(s);                
      }
      public  static  float  Avg(float  Input1,  float  Input2)            
      {
            return  (Input1  +  Input2)  /  2.0F;                              
      }
}
    
   
  
   



Output

5.5


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Float