поедет налево назад
Объяснение:
мне нужно чтоб было 20 символов по етому вот
#include <iostream>
long prodDigitExcept_2_9(int N) {
long prod = 1;
bool haveNeedDigit = false;
while (N > 0) {
int temp = N % 10;
if (temp != 2 and temp != 9) {
prod *= temp;
haveNeedDigit = true;
}
N /= 10;
}
if (haveNeedDigit)
return prod;
return -1;
}
long prodDigit(int N) {
long prod = 1;
while (N > 0) {
prod *= N % 10;
N /= 10;
}
return prod;
}
signed main() {
setlocale(LC_ALL, "Rus");
int N;
std::cin >> N;
long result = prodDigit(N);
if (result == -1)
std::cout << "В данном числе нет подходящих цифр!";
else
std::cout << result;
return 0;
}
#include <iostream>
#include <cmath>
signed main()
{
setlocale(LC_ALL, "Rus");
int cnt, countBoys = 0, countGirls = 0, sumHeightBoys = 0, sumHeightGirls = 0;
std::cout << "Введите количество детей в классе: ";
std::cin >> cnt;
int* height = new int[cnt];
for (int i = 0; i < cnt; i++)
{
std::cout << "Рост ребёнка №" << i + 1 << ": ";
std::cin >> height[i];
if (height[i] < 0) {
countBoys++;
sumHeightBoys += height[i];
}
else {
countGirls++;
sumHeightGirls += height[i];
}
}
std::cout << "Средний рост мальчиков: " << abs(sumHeightBoys) / countBoys << std::endl;
std::cout << "Средний рост девочек: " << sumHeightGirls / countGirls << std::endl;
return 0;
}
ла-ла-ла-ла