Venciity

Operators Test

Jan 29th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace operatorsTest
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int a = 6;
  14.             int b = 4;
  15.             Console.WriteLine(a > b ? "a>b" : "b>=a"); // a>b
  16.             Console.WriteLine(a is int); // True
  17.             Console.WriteLine(b is double); // False
  18.             Console.WriteLine(sizeof(double)); //8 байта (double е 64 битов тип)
  19.             Console.WriteLine(typeof(float)); //System.Single
  20.             Console.WriteLine((a + b) / 2); // 5
  21.  
  22.             string scream = new string('a', 10);
  23.             Console.WriteLine(scream);
  24.  
  25.             string greeting = null;
  26.             Console.WriteLine(greeting ?? "Hello");
  27.  
  28.             greeting = "Hi!";
  29.             Console.WriteLine(greeting ?? "Hello");
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment