Составьте алгоритм вычисления суммы целых чисел x, y, z. Определить
четная ли она, если четная, то найти среднее арифметическое значение
данных чисел, если нечетная, то найти их среднее геометрическое значение.
Ответы на вопрос
Ответил BoDyH
0
// Example program C++
#include <iostream>
#include <cmath>
int main(){int x,y,z,sum;
double itog;
std::cout << "x" << "y" << "zn";
std::cin >> x >> y >> z;sum = x+y+z;
std::cout << "ostatok: " << sum%2;
if (sum%2 > 0) {
itog = std::sqrt (x*y*z);
std::cout << "nSrednee geom is: " << itog;}
else {
itog = sum/3;std::cout << "nSrednee arif is: " << itog;
}
return 0;
}
#include <iostream>
#include <cmath>
int main(){int x,y,z,sum;
double itog;
std::cout << "x" << "y" << "zn";
std::cin >> x >> y >> z;sum = x+y+z;
std::cout << "ostatok: " << sum%2;
if (sum%2 > 0) {
itog = std::sqrt (x*y*z);
std::cout << "nSrednee geom is: " << itog;}
else {
itog = sum/3;std::cout << "nSrednee arif is: " << itog;
}
return 0;
}
Ответил BoDyH
0
блок схема :
Новые вопросы