Am nevoie de asta urgent, 50 pct!!!
Răspunsuri la întrebare
// 1.
#include <iostream>
int main() {
size_t n, temp, mn;
std::cin >> n;
if (!n--)
return 0;
std::cin >> mn;
while (n--) {
std::cin >> temp;
if (mn > temp)
mn = temp;
}
std::cout << mn;
}
// 2.
#include <iostream>
int main() {
size_t n, temp, mx;
std::cin >> n;
if (!n--)
return 0;
std::cin >> mx;
while (n--) {
std::cin >> temp;
if (mx < temp)
mx = temp;
}
std::cout << mx;
}
// 3.
#include <iostream>
int main() {
size_t n, temp, mx = SIZE_MAX;
std::cin >> n;
while (n--) {
std::cin >> temp;
if (!(temp & 1) && (mx < temp || mx == SIZE_MAX))
mx = temp;
}
std::cout << (mx != SIZE_MAX ? mx : 0);
}
// 4.
#include <iostream>
int main() {
size_t temp, mx = SIZE_MAX;
for (;;) {
std::cin >> temp;
if (temp == SIZE_MAX)
break;
if (!(temp & 1) && (mx < temp || mx == SIZE_MAX))
mx = temp;
}
std::cout << (mx != SIZE_MAX ? mx : 0);
}
// 5.
#include <iostream>
int main() {
size_t temp, mn = SIZE_MAX;
for (;;) {
std::cin >> temp;
if (!temp)
break;
if (temp & 1 && mn > temp)
mn = temp;
}
std::cout << (mn != SIZE_MAX ? mn : 0);
}