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
#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";
}
Comments
Leave a comment