#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
int n;
cout << "Введи количество чисел: "; cin >> n;
int a, b;
cout << "Введи левую границу (a): "; cin >> a;
cout << "Введи правую границу (b): "; cin >> b;
int *p = new int[n];
for (int i = 0; i < n; i++)
cin >> p[i];
if (p[i] <= b && p[i] >= a)
cout << " " << p[i];
}
delete[] p;
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
int n;
cout << "Введи количество чисел: "; cin >> n;
int a, b;
cout << "Введи левую границу (a): "; cin >> a;
cout << "Введи правую границу (b): "; cin >> b;
int *p = new int[n];
for (int i = 0; i < n; i++)
cin >> p[i];
for (int i = 0; i < n; i++)
{
if (p[i] <= b && p[i] >= a)
cout << " " << p[i];
}
delete[] p;
return 0;
}