Teo_Yanchev

2.Division - C# Fundamentals

Sep 17th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace demo
  5. {
  6. class Program
  7. {
  8. static void Main()
  9. {
  10. double number = double.Parse(Console.ReadLine());
  11.  
  12. string output = string.Empty;
  13.  
  14.  
  15. if (number % 10 == 0)
  16. {
  17. output = "The number is divisible by 10";
  18. }
  19. else if (number % 7 == 0)
  20. {
  21. output = "The number is divisible by 7";
  22. }
  23. else if (number % 2 == 0 && number % 3 == 0)
  24. {
  25. output = "The number is divisible by 6";
  26. }
  27. else if (number % 3 == 0)
  28. {
  29. output = "The number is divisible by 3";
  30. }
  31. else if (number % 2 == 0)
  32. {
  33. output = "The number is divisible by 2";
  34. }
  35. else
  36. {
  37. output = "Not divisible";
  38. }
  39.  
  40.  
  41. Console.WriteLine(output);
  42. }
  43. }
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment