9. Fruit or Vegetable (If Construction)
Ivan Ivanov
Posted on January 20, 2023
using System;
namespace FruitOrVegetable_If_
{
internal class Program
{
static void Main(string[] args)
{
string product = Console.ReadLine();
if (product == "banana" || product == "apple" || product == "kiwi" || product == "cherry" || product == "lemon" || product == "grapes")
{
Console.WriteLine("fruit");
}
else if (product == "tomato" || product == "cucumber" || product == "pepper" || product == "carrot")
{
Console.WriteLine("vegetable");
}
else
{
Console.WriteLine("unknown");
}
}
}
}
💖 💪 🙅 🚩
Ivan Ivanov
Posted on January 20, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.