An int, a short, and a float are included in a mathematical expression giving a float result.
using System;
class FloatTest
{
static void Main()
{
int x = 3;
float y = 4.5f;
short z = 5;
var result = x * y / z;
Console.WriteLine("The result is {0}", result);
Type type = result.GetType();
Console.WriteLine("result is of type {0}", type.ToString());
}
}
Related examples in the same category