Advertisement
YavorJS

Fruits and Vegetables 2

May 13th, 2016
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 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 ComplexConditionalStatements
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var product = Console.ReadLine();
  14. switch (product)
  15. {
  16. case "banana":
  17. case "apple":
  18. case "kiwi":
  19. case "cherry":
  20. case "lemon":
  21. case "grapes":
  22. {
  23. product = "fruit";
  24. }
  25. break;
  26. case "tomato":
  27. case "cucumber":
  28. case "pepper":
  29. case "carrot":
  30. {
  31. product = "vegetable";
  32. }
  33. break;
  34. default:
  35. {
  36. product = "unknown";
  37. }
  38. break;
  39. }
  40. Console.WriteLine(product);
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement