Составьте алгоритм вычисления суммы целых чисел x, y, z. Определить
четная ли она, если четная, то найти среднее арифметическое значение
данных чисел, если нечетная, то найти их среднее геометрическое значение.
Ответы
Ответ дал:
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;
}
Ответ дал:
0
блок схема :
Вас заинтересует
2 года назад
2 года назад
7 лет назад
9 лет назад
9 лет назад
10 лет назад