I thought its even more neat to use sets. Just loop through all years and insert them in the set. Then we can check if a year is good or not in o(logn).
I dont like your short editorials @taran_1407 please make longer ones as they are more informative and I get to learn something from them
Is this solution correct?
#include<stdio.h>
int main()
{
int N;
printf(āEnter to verify if SnackDown was hosted in a given year\nā);
scanf("%d",&N);
switch (N)
{
case 2010 :
printf("HOSTED");
break;
case 2011 :
printf("NOT HOSTED");
break;
case 2012 :
printf("NOT HOSTED");
break;
case 2013 :
printf("NOT HOSTED");
break;
case 2014 :
printf("NOT HOSTED");
break;
case 2015 :
printf("HOSTED");
break;
case 2016 :
printf("HOSTED");
break;
case 2017 :
printf("HOSTED");
break;
case 2018 :
printf("NOT HOSTED");
break;
case 2019 :
printf("HOSTED");
break;
}