Answer to Question #257967 in C++ for Shaminie

Question #257967
Create a program that will ask a user to enter a number.If the number is between 0 and 4,write the word blue.If the number is between 5 and 10,write the word red.If the number is between 11 and 14,write the word green.If it is any other number,write that it is not a correct color option.
1
Expert's answer
2021-10-28T01:58:57-0400
#include<iostream>
using namespace std;
int main()
{
	int number;
	cout<<"Please, enter a number to find out your color:";
	cin>>number;
	if(number>=0&&number<=4)
	{
		cout<<"BLUE";
	}
	else if(number>=5&&number<=10)
	{
		cout<<"RED";
	}
	else if(number>=11&&number<=14)
	{
		cout<<"GREEN";
	}
	else
	{
		cout<<"It is not a correct color option";
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS