Advertisement
SailorFini

C# - Intro to Numbers

Apr 8th, 2020
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. int a = 18;
  2. int b = 6;
  3. int c = 23;
  4. int d = a * (b + c) - 43 + 73 * b;
  5. Console.WriteLine(d);
  6. int e = (a + b) / c;
  7. int f = (a + b) % c;
  8. Console.WriteLine($"quotient: {e}");
  9. Console.WriteLine($"remainder: {f}");
  10. int max = int.MaxValue;
  11. int min = int.MinValue;
  12. Console.WriteLine($"The range of integers is {min} to {max}");
  13. int what = max + 3;
  14. Console.WriteLine($"An example of overflow: {what}");
  15. //
  16. double g = 35;
  17. double h = 574;
  18. double i = 73;
  19. double j = (g + h) / i + 36 / 52 * h - 25 + g;
  20. Console.WriteLine(j);
  21. double maxx = double.MaxValue;
  22. double minn = double.MinValue;
  23. Console.WriteLine($"The range of double is {minn} to {maxx}");
  24. double third = 1.0 / 3.0;
  25. Console.WriteLine(third);
  26. //
  27. decimal miin = decimal.MinValue;
  28. decimal maax = decimal.MaxValue;
  29. Console.WriteLine($"The range of the decimal type is {miin} to {maax}");
  30. double l = 1.0;
  31. double m = 3.0;
  32. Console.WriteLine(l / m);
  33. //
  34. decimal n = 1.0M;
  35. decimal o = 3.0M;
  36. Console.WriteLine(n / o);
  37. //
  38. decimal PI = 3.1415926535897931M;
  39. decimal k = 2.5M;
  40. Console.WriteLine(k * k * PI);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement