Answer to Question #310893 in C++ for Secret Agent

Question #310893

I'm really fond of even numbers, you know? That's why I'll be letting you make another even number problem yet again. This time, you need to print from a range of two inputted numbers, n1 and n2 (inclusive), all the even numbers from n2 down to n1, in descending order.





How about that?



Input



A line containing two integers separated by a space.



3·10


Output



Multiple lines containing an integer.



10


8


6


4

1
Expert's answer
2022-03-15T02:57:43-0400
using namespace std;


int main()
{
	int n1,n2,n;
	
	cout<<"\n\tEnter N1: "; cin>>n1;
	cout<<"\n\tEnter N2: "; cin>>n2;
	cout<<"\n\tEven Numbers: ";
	for(n=n2;n>=n1;n--)
	{
		if(n%2==0) cout<<n<<", ";
	}
	return(0);
}

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