Pass float to a function : float « Data Type « C# / CSharp Tutorial






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;               
   }
}
5.5








2.25.float
2.25.1.Float Literals
2.25.2.Use Remainder Operator on float point data type
2.25.3.floats and arithmetic operators
2.25.4.Pass float to a function