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 21:40
Write c function that can replace all the positive elements to 0 and negative to 1 in undefined length one-dimensional array. test your program in the main program by defining one-dimensional array of 6 elements
Answers: 1
question
Computers and Technology, 22.06.2019 15:00
When designing content as part of your content marketing strategy, what does the "think" stage represent in the "see, think, do, care" framework?
Answers: 3
question
Computers and Technology, 23.06.2019 00:30
Knowing that the central portion of link bd has a uniform cross sectional area of 800 mm2 , determine the magnitude of the load p for which the normal stress in link bd is 50 mpa. (hint: link bd is a two-force member.) ans: p = 62.7 kn
Answers: 2
question
Computers and Technology, 23.06.2019 02:00
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
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
Social Studies, 16.12.2019 02:31
Questions on the website: 13722361