Codechef : Problem name " Spice Level " solution in C#
===========================Solution=======================
using System;
public class Test
{
public static void Main()
{
int t=Convert.ToInt32(Console.ReadLine());
for(int i=0;i<t;i++){
int X=Convert.ToInt32(Console.ReadLine());
if(X<4){
Console.WriteLine("MILD");
}
else if(X>=4 && X<7)
Console.WriteLine("MEDIUM");
else if(X>=7)
Console.WriteLine("HOT");
}
}
}
=========================Explanation====================
As per the condition if the level of spices is less than 4 then it is MILD
if level of spices is greater than equal to 4 and less than 7 then it is MEDIUM
if level of spices is grater than equal to 7 then it is HOT
Comments
Post a Comment