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 22:00
What must you do before formatting a paragraph?
Answers: 1
question
Computers and Technology, 22.06.2019 06:50
Match the personality traits with their description
Answers: 1
question
Computers and Technology, 23.06.2019 21:40
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings. for each match, add one point to user_score. upon a mismatch, end the game. sample output with inputs: 'rrgbryybgy' 'rrgbbrybgy'
Answers: 3
question
Computers and Technology, 24.06.2019 03:00
Will do anything for brainlest so can you guys me out i will try my best to you out
Answers: 1
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, 17.12.2021 05:20
question
Mathematics, 17.12.2021 05:20
Questions on the website: 13722359