The function below takes one parameter: a list of numbers (number_list). Complete the function to count how many of the numbers in the list are greater than 100. The recommended approach for this: (1) create a variable to hold the current count and initialize it to zero, (2) use a for loop to process each element of the list, adding one to your current count if it fits the criteria, (3) return the count at the end.

Respuesta :

Answer:

#include<iostream>

#include<conio.h>

using namespace std;

main()

{

int n;

cout<<"enter the size of array"<<endl;

cin>>n;

int a[n],count=0;

 

 

for (int i=0;i<n;i++)

{

 cout<<"\nenter the values in array"<<i<<"=";

 cin>>a[i];  

}

 

for (int j=0;j<n;j++)

{

 if (a[j]>=100)

 {

  count=count+1;

 }

}

cout<<"Total Values greater than 100 are ="<<count;

getch();

}

Explanation:

In this program, an array named as 'a' has been taken as integer data type. The array haves variable size, user can change the size of array as per need or demand.

Values will be inserted by user during run time. This program will check that how many values are greater than and equal to 100 in array. The number of times 100 or greater value will appear in array, it count the value in variable "count". After complete traversal of array the result will shown on output in terms of total number of count of value greater than or equal to 100.

ACCESS MORE