Greater Than X c++ example
<h2 data-original-attrs="{"style":""}" dir="ltr" style="color: rgb(0, 0, 0); font-family: "Times New Roman";">Question</h2><h4 data-original-attrs="{"style":""}" dir="ltr" style="color: rgb(0, 0, 0); font-family: "Times New Roman"; font-size: medium;">Ali's Mom is trying to help him to learn basic math. She bought him N Lego pieces written on it some numbers. She tells him a number X, and he has to figure out how many numbers written on the Lego are strictly greater than X.<br><br>Input Format<br>The first line contains the number of Lego pieces N and integer X.<br>The next line contains N integers represent the numbers written on the Lego. 3 2<br>5 3 8<br>Output Format:<br>3</h4><div><br></div>
#include <iostream>
using namespace std;
int main()
{
int lego_n,num,x,count=0;
cin>>lego_n>>x;
for(int i=1; i<=lego_n;i++)
{
cin>>num;
if(num>1000)
{
continue;
}
if (num>x)
{
count++;
}
}
cout<<count;
}