Answer to Question #331738 in C++ for Besufekad

Question #331738

Write a c++ program to read 10 integers from the keyboard in the range 0-100 and count how many of them are larger than 50

1
Expert's answer
2022-04-21T07:02:56-0400
#include <iostream>

using namespace std;

int main()
{
	const int N = 10;
	int arr[N];
	int count = 0;
	cout << "Please, enter 10 values 0-100: ";
	for (int i = 0; i < N; i++)
	{
		cin >> arr[i];
	}
	for (int i = 0; i < N; i++)
	{
		if(arr[i]>50)
			count++;
	}
	cout << count << " of them are larger than 50";
}

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