int type overflow - CSharp Language Basics

CSharp examples for Language Basics:int

Description

int type overflow

Demo Code

using System;/* www  .j  av  a2s  .  c  o m*/
public class Overflow
{
   public static void Main()
   {
      uint totalMinutesOnMobile;
      uint totalPopulation;
      ushort averageMinutesOnMobile;
      totalPopulation = 4000000000;
      averageMinutesOnMobile = 10;
      // uint cannot be implicitly converted to int.
      totalMinutesOnMobile = totalPopulation * averageMinutesOnMobile;
      Console.WriteLine("Total Minutes On Mobiles: " + totalMinutesOnMobile);
   }
}

Result


Related Tutorials