subject

Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. That list is followed by two more integers representing lower and upper bounds of a range. Your program should output all integers from the list that are within that range (inclusive of the bounds). For coding simplicity, follow each output integer by a space, even the last one. The output ends with a newline. I cant figure out how to create the new line.

Ex: If the input is:

5 25 51 0 200 33
0 50
then the output is:

25 0 33
(the bounds are 0-50, so 51 and 200 are out of range and thus not output).

To achieve the above, first read the list of integers into a vector.

This is what i have so far:
#include

int main()

{

int n, min, max, i;

int arr[20];

scanf("%d",&n);

for(i=0;i
scanf("%d",&arr[i]);

}

scanf("%d",&min);

scanf("%d",&max);

for(i=0;i
if(arr[i]>=min && arr[i]<=max){

printf( "%d ", arr[i] ) ;

}

}

return 0;

}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 19:30
Keep your choice of a major there is probably no single correct choice.
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Helen is having a meeting with her colleagues in her company. they are working on the goals and objectives for the coming year. they want to ensure that these goals and objectives of the processes involved are properly evaluated. which system can helen and her colleagues apply to evaluate this? helen and her colleagues require a blank to evaluate the goals and objectives.
Answers: 2
question
Computers and Technology, 23.06.2019 16:30
What is one reason why indoor air pollution has become an increasing problem.
Answers: 1
question
Computers and Technology, 23.06.2019 23:00
How do you know if the website is secure if you make a purchase
Answers: 2
You know the right answer?
Write a program that first gets a list of integers from input. The input begins with an integer indi...
Questions
question
Mathematics, 29.03.2021 23:30
question
English, 29.03.2021 23:30
question
Mathematics, 29.03.2021 23:30
question
Mathematics, 29.03.2021 23:30
Questions on the website: 13722363