Advertisement
Felanpro

More basic stuff

Aug 9th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 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 csharp_youtube_tutorial
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var x = "Helluu"; //Basically a constant in c++.
  14.  
  15.             //Get type of data
  16.             Console.WriteLine("variable x is a {0}", x.GetTypeCode());
  17.  
  18.             //Casting
  19.             double pi = 3.14;
  20.             int pi_convert_int = (int)pi; //Convert pi to int
  21.  
  22.             //Some math functions. (built-ins)
  23.             int z = 5;
  24.             int y = 3;
  25.  
  26.             Console.WriteLine(Math.Max(z, y));
  27.             Console.WriteLine(Math.Min(z, y));
  28.  
  29.             Console.WriteLine(Math.Sqrt(49));
  30.  
  31.             Console.WriteLine(Math.Pow(y, 5));
  32.  
  33.             //Generating random numbers.
  34.             Random rand = new Random();
  35.             Console.WriteLine("Generating random number {0}", (rand.Next(1, 11)));
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement