Advertisement
thegrudge

NullVariablesArithmetic

Nov 13th, 2014
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2. class NullVariablesArithmetic
  3. {
  4.     static void Main()
  5.     {
  6.         int? nullInteger = null;
  7.         double? nullDouble = null;
  8.  
  9.         Console.WriteLine("The value of the null integer is: {0};", nullInteger);
  10.         Console.WriteLine("The value of the null double is: {0};", nullDouble);
  11.  
  12.         Console.WriteLine("Sum the variables with 5");
  13.         Console.WriteLine("The value of the null integer is: {0};", nullInteger+5);
  14.         Console.WriteLine("The value of the null double is: {0};", nullDouble+5);
  15.  
  16.         Console.WriteLine("Sum the variables with null literal");
  17.         Console.WriteLine("The value of the null integer is: {0};", nullInteger + null);
  18.         Console.WriteLine("The value of the null double is: {0};", nullDouble + null);
  19.  
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement