Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Fruit_or_Vegetable
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- string[] fruits = { "banana", "apple", "kiwi", "cherry", "lemon", "grapes" };
- string[] vegetable = { "tomato", "cucumber", "pepper", "carrot" };
- if (Array.Exists(fruits, element => element == input))
- {
- Console.WriteLine("fruit");
- }
- else if (Array.Exists(vegetable, element => element == input))
- {
- Console.WriteLine("vegetable");
- }
- else
- {
- Console.WriteLine("unknown");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement