Mega Code Archive

 
Categories / C# / Data Types
 

An int, a short, a float, and a double are added together giving a double result

using System; // Mixing types in expressions class MixedTypes {     static void Main()     {         int x = 3;         float y = 4.5f;         short z = 5;         double w = 1.7E+3;         // Result of the 2nd argument is a double:         Console.WriteLine("The sum is {0}", x + y + z + w);     } }