Answer to Question #260543 in C++ for Zaido Green

Question #260543

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.if else statement

1
Expert's answer
2021-11-03T00:46:41-0400
#include<iostream>
using namespace std;
int main()
{
	int n;
	cout<<"Enter a number: ";
	cin>>n;
	if(n>=0 && n<=4){
		cout<<"Blue";
	}
	else if(n>=5 && n<=10){
		cout<<"Red";
	}
	else if(n>=11 && n<=14){
		cout<<"Green";
	}
	else{
		cout<<"That 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