#include <iostream>
double dividend(int x, int y, int z) {
double pow_x = x * x;
double sin = std::sin(pow_x);
double pow_y = y * y * y * y;
double abs = std::abs(-z + std::sqrt(pow_y));
return sin - abs;
}
double divider(int x, int y, int z) {
double pow_y = y * y;
double pow_z = z * z;
double dividend = pow_x + pow_y + pow_z;
double pow_y_z = y;
for (size_t i = 0; i < z; i++)
{
pow_y_z *= y;
double divider = x * pow_y_z + 2;
if (!divider) {
std::cout << "Divider cannot be zero!";
std::exit(-1);
return 1 - (dividend / divider);
int main() {
double x, y, z;
std::cout << "Enter x, y, z" << std::endl;
std::cin >> x >> y >> z;
auto dividend_res = dividend(x, y, z);
auto divider_res = divider(x, y, z);
if (!divider_res) {
std::exit(-2);
std::cout <<"a = " << dividend_res / divider_res;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <iostream>
double dividend(int x, int y, int z) {
double pow_x = x * x;
double sin = std::sin(pow_x);
double pow_y = y * y * y * y;
double abs = std::abs(-z + std::sqrt(pow_y));
return sin - abs;
}
double divider(int x, int y, int z) {
double pow_x = x * x;
double pow_y = y * y;
double pow_z = z * z;
double dividend = pow_x + pow_y + pow_z;
double pow_y_z = y;
for (size_t i = 0; i < z; i++)
{
pow_y_z *= y;
}
double divider = x * pow_y_z + 2;
if (!divider) {
std::cout << "Divider cannot be zero!";
std::exit(-1);
}
return 1 - (dividend / divider);
}
int main() {
double x, y, z;
std::cout << "Enter x, y, z" << std::endl;
std::cin >> x >> y >> z;
auto dividend_res = dividend(x, y, z);
auto divider_res = divider(x, y, z);
if (!divider_res) {
std::cout << "Divider cannot be zero!";
std::exit(-2);
}
std::cout <<"a = " << dividend_res / divider_res;
}