Computer Science, asked by yogeshlolage0007, 17 days ago

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. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value. Assume that the list will always contain fewer than 20 integers.

Answers

Answered by rizvitaqi21
0

Answer:

come to me I have solutions

Attachments:
Answered by shilpa85475
0

The input begins with an integer indicating the number of integers that follow. T

hen, get the last value from the input, which indicates a threshold.

Explanation:

#include <iostream>

#include <vector>

using namespace std;

int main()

{

vector<int> vec;

 int n=20, num, t;

 cin >> n;

 for (int i = 0; i < n; ++i) {

  cin >> num;

 vec.push_back(num);

    }

 cin >> t;

  for (int i = 0; i < vec.size(); ++i) {

       if (vec[i] <= t) {

         cout << vec[i] << " ";

      }

   }

    cout << endl;

    return 0;

}

Similar questions