Advertisement
n4wn4w

C# .NET metodi

Apr 15th, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. metod za vreme ///
  2.  
  3.             DateTime now = DateTime.Now;
  4.             DateTime softUni = new DateTime(2013, 11, 4);
  5.             Console.WriteLine(now);
  6.             Console.WriteLine(softUni);
  7.  
  8.             Console.WriteLine("SoftUni's Age : {0}", now - softUni);
  9. ///
  10.  
  11.  // Using dates (System.DateTime)
  12.             DateTime today = DateTime.Now;
  13.             Console.WriteLine("Today is: " + today);
  14.             DateTime tomorrow = today.AddDays(1);
  15.             Console.WriteLine("Tomorrow is: " + tomorrow);
  16.  
  17. // Calculate cosinus (System.Math)
  18.             double angleDegrees = 60;
  19.             double angleRadians = angleDegrees * Math.PI / 180;
  20.             Console.WriteLine("Cos({0} degrees) = {1}",
  21.                 angleDegrees, Math.Cos(angleRadians));
  22.  
  23.  
  24.  // Generating random numbers (System.Random)
  25.             Random rnd = new Random();
  26.             Console.WriteLine("Random number in the range [1-99]: " +
  27.                 rnd.Next(1, 100));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement