![crawford184232323234](/avatars/15758.jpg)
crawford184232323234
17.12.2020 •
Computers and Technology
An array, numbers, of integers is filled with 100 random numbers whose values are greater than 10 and less than 255. You DO NOT have to write code to generate the random numbers. Write the code to count how many of the even numbers in the array are greater than 10 and less than 157 (inclusive).
Solved
Show answers
More tips
- G Goods and services What Useful Foods Can You Buy at Supermarkets?...
- G Goods and services How to Choose the Best Publishing House for Your Children s Book: Tips and Recommendations...
- S Science and Technology When do we change our clocks?...
- A Animals and plants How to Teach Your Parrot to Talk?...
- F Family and Home How to Remove Fading from Clothes: Tips and Tricks...
- F Food and Cooking How to Make Polendwitsa at Home?...
- F Family and Home Parents or Environment: Who Has the Most Influence on a Child s Upbringing?...
- P Philosophy Unbelievable stories of encounters with otherworldly forces...
- L Leisure and Entertainment How to Choose the Perfect Gift for Men on February 23rd?...
- H Health and Medicine How to Treat Whooping Cough in Children?...
Answers on questions: Computers and Technology
- M Mathematics The bold question i’m just confused...
- M Mathematics Given: KL || MN Prove: KM/JM = LN/JL...
- M Mathematics Help a fellow out please...
- E English Select the answer that best classifies the argument. A rabid dog is like an unexploded bomb. You would never play with an unexploded bomb. So, you should never play...
Ответ:
int counter = 0;
for(int i =0;i<100;i++){
if(myarr[i]%2==0){
if(myarr[i] > 10 && myarr[i]<157){
counter++;
}
}
}
cout<<counter;
Explanation:
The question is answered using c++ and it assumes that the array name is myarr
This line initializes counter to 0
int counter = 0;
This iterates through the array
for(int i =0;i<100;i++){
This checks if current array element is even number
if(myarr[i]%2==0){
If the above condition is true; This checks if the array element is within the range of 10 and 157 (inclusive)
if(myarr[i] >= 10 && myarr[i]=<157){
If yes, the counter is increased by 1
counter++;
}
}
}
This prints the total counter number
cout<<counter;
Ответ: