Day 3: Intro to Conditional Statements
C++ Solution:
-By Dinesh Kumar E
#include<iostream>
using namespace std;
int a,b;
void check(int x)
{
b=a%2;
switch(b)
{
case 0:
{
if(a<=5)
{
cout<<"Not Weird";}
if(a>5)
{
if(a<=20)
{
cout<<"Weird";
}
else
{
cout<<"Not Weird";
}
}
break;
}
case 1:
cout<<"Weird";
}
}
int main()
{
cin>>a;
check(a);
}
Comments
Post a Comment