Так как язык не указан, приведу пример на SWI-Prolog.
Код:
read_int(Int) :- read(Int), integer(Int).split_int_by_numbers(0, []) :- !.split_int_by_numbers(N, [Number|Ints]) :- Number is mod(N, 10), RestN is div(N, 10), split_int_by_numbers(RestN, Ints).test_to_div(_, []).test_to_div(N, [Number|Ints]) :- mod(N, Number) =:= 0, test_to_div(N, Ints). test(Int) :- split_int_by_numbers(Int, Numbers), test_to_div(Int, Numbers), write(Int), write(" - Yes!"), nl.test(Int) :- write(Int), write(" - No!"), nl.?- read_int(Int), test(Int).

#include <iostream>
#include <string>
#define N 5
using namespace std;
int count_flat = 0;
struct Flat {
int n_rooms;
int square;
int floor;
string address;
double price;
void PrintInfo() {
cout << "\nКоличество комнат: " << n_rooms << "\nПлощадь " << square << "\nЭтаж:" << floor << "\nАдрес " << address << "\nЦена: " << price;
}
void InputInfo() {
cout << "Количество комнат: ";
cin >> n_rooms;
cout << "Площадь: ";
cin >> square;
cout << "Этаж: ";
cin >> floor;
cout << "Адрес: ";
getline(cin, address);
cout << "Цена: ";
cin >> price;
}
void PrintChecksInfo(int number) {
if (number >= price) {
count_flat++;
PrintInfo();
}
}
};
signed main() {
setlocale(LC_ALL, "Rus");
int choice;
Flat mas[N];
for (int i = 0; i < N; i++)
mas[i].InputInfo();
cout << "Введите стоимость: ";
cin >> choice;
for (int i = 0; i < N; i++) {
mas[i].PrintChecksInfo(choice);
}
if (count_flat <= 0)
cout << "Таких квартир нет!";
return 0;
}