Exemplo n.º 1
0
 static void Main(string[] args)
 {
     Console.WriteLine("101 + 99 = {0}", MyMath1.Add(101, 99));
     // this wil result in
     Console.WriteLine("101 + 201 = {0}", MyMath1.Add(101, 201));
     // byte is 255 bits, insignificant bits will be lost
 }
        static void Main(string[] args)
        {
            // add code to console app Main and test Add Method
            Console.WriteLine("101 + 99 = {0}", MyMath1.Add((byte)101, (byte)99));

            // below example shows how higher than a byte is returned (remainder)
            Console.WriteLine("101 + 201 = {0}", MyMath1.Add(101, 201));
        }
 static void Main(string[] args)
 {
     // casting 101 and 99 to bytes to make sure I'm sending bytes to method MyMath1
     Console.WriteLine("101 + 99 = {0}", MyMath1.Add((byte)101, (byte)99));
     // bytes are maximum 256, so if you add more than that it overflows and
     // disposes of the significant value and keeps the insignificant
     Console.WriteLine("101 + 201 = {0}", MyMath1.Add(101, 201));
 }
        static void Main(string[] args)
        {
            // using add method in main:
            Console.WriteLine("101 + 99 = {0}", MyMath1.Add((byte)101, (byte)99));
            // this answer is wrong when run bc of data type limitations?
            Console.WriteLine("101 + 201 = {0}", MyMath1.Add((byte)101, (byte)201));

            // overflow example skipped
        }
Exemplo n.º 5
0
 static void Main(string[] args)
 {
     Console.WriteLine("101 + 99 = {0}", MyMath1.Add((byte)101, (byte)99));
     Console.WriteLine("101 + 201 = {0}", MyMath1.Add(101, 201));
 }