Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2.  
  3. namespace switchCase
  4. {
  5. class MainClass
  6. {
  7. public static void Main(string[] args)
  8. {
  9. Console.WriteLine("Enter Colour Of Trafic Light");
  10. string colour = Console.ReadLine();
  11.  
  12. switch (colour)
  13. {
  14. case "Green":
  15. {
  16. Console.WriteLine("This is a green trafic light");
  17. break;
  18. }
  19.  
  20. case "Yellow":
  21. {
  22. Console.WriteLine("This is a yellow light");
  23. break;
  24. }
  25.  
  26.  
  27.  
  28. case "Red":
  29. {
  30. Console.WriteLine("This is a Red light");
  31. break;
  32.  
  33. }
  34. default:
  35. {
  36. Console.WriteLine(" This is not a trafic light ");
  37. break;
  38.  
  39. }
  40.  
  41.  
  42.  
  43.  
  44. }
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement