Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 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 lesson4operators {
  8. class Program {
  9. static void Main(string[] args) {
  10. Console.WriteLine(5);
  11. Console.WriteLine(+5);
  12. Console.WriteLine(5 + 5);
  13. Console.WriteLine(5 + .5);
  14. Console.WriteLine("5" + "5");
  15. Console.WriteLine("5" + 5);
  16.  
  17.  
  18. Console.WriteLine("minus section");
  19. int a = 5;
  20. Console.WriteLine(a - 1);
  21. Console.WriteLine(-a);
  22.  
  23. Console.WriteLine("wth is negation operator used for?");
  24.  
  25. Console.WriteLine("double") //i dont understand double. why cant i use int?
  26. ; double x = 1.5; //why does it need a semicolon at the beginning?
  27. Console.WriteLine(x);
  28. Console.WriteLine(x++);
  29. Console.WriteLine(x);
  30. Console.WriteLine(++x);
  31. Console.WriteLine(x);
  32.  
  33.  
  34. Console.WriteLine("if");
  35. int b = 2;
  36. Console.WriteLine(b);
  37. Console.WriteLine(++b);
  38.  
  39. int c = 10;
  40. int d = 8;
  41.  
  42. if (c > 9) {
  43. if (d > 9) {
  44. Console.WriteLine("result 1");
  45. }
  46. else {
  47. Console.WriteLine("result 2");
  48. }
  49. }
  50.  
  51. if (c > 9) {
  52. if (d > 9) {
  53. Console.WriteLine("result 1");
  54. }
  55. else {
  56. Console.WriteLine("result 2"); //why don't two 'result 2's appear ?
  57. }
  58. }
  59.  
  60.  
  61. Console.WriteLine("totally modulus dood");
  62. Console.WriteLine(5 % 2);
  63. Console.WriteLine(5 % 2.2);
  64. Console.WriteLine(5 % 5);
  65.  
  66. //ignore shifts?
  67.  
  68. Console.WriteLine(1 is int);
  69. Console.WriteLine("dog" is int); //these say always and never so im not sure when its supposed to be used
  70.  
  71. Console.ReadLine();
  72. }
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement