41.4k views
4 votes
A restaurant recorded the ages of customers on two separate days. You are going to write a program to compare the number of customers in their twenties (ages 20 to 29). What is the missing line of code to count the number of customers in their twenties? customerAges = [13, 3, 11, 24, 35, 25, 15, 18, 1] count20s = 0 if 20 <= item <= 29: count20s = count20s + 1

User Yusufaytas
by
4.8k points

1 Answer

5 votes

Answer:

You will need to implement a for loop ( I am assuming this is java)

Step-by-step explanation:

int count20s = 0;

for(int x =0; x< customerAges.length;x++){

if(20 <= customerAges[x] && customerAges[x] <= 29){

count20s++;

}

User Tamuhey
by
4.8k points