помогите дописать код.
int main()
{
double x,y,f,d;
int k=0;
printf("Input x-> ");
scanf("%if", &x);
printf("Input y-> ");
scanf("%if", &y);
printf("Select f: 1 - arcsin(x/y), 2 - e^y, 3 - ln(x*y) ->");
scanf("%d", &k);
switch(k)
{
case 1: f=asin(y/x); break;
case 2: f=exp(y); break;
case 3: f=log(x*y); break;
default: printf("Function is not selected\n");
return 1;
}
if (x>y)
{
Answers & Comments
Verified answer
#include <stdio.h>#include <math.h>
int main()
{
float x,y,f,d;
int k=0;
printf("Input x-> ");
scanf("%f", &x);
printf("Input y-> ");
scanf("%f", &y);
printf("Select f: 1 - arcsin(x/y), 2 - e^y, 3 - ln(x*y) ->");
scanf("%d", &k);
if (k<1 || k>3)
printf("Function is not selected\n");
else {
switch(k)
{
case 1: f=asin(y/x); break;
case 2: f=exp(y); break;
case 3: f=log(x*y); break;
}
if (x>y) d=pow(f-y,1.0/3)+tan(f);
else if (x<y) d=pow(y-f,3)+cos(f);
else d=pow(y+f,2)+x*x*x;
printf("d = %f",d);
}
}
Пример:
Input x-> 0.8
Input y-> 1ю4
Select f: 1 - arcsin(x/y), 2 - e^y, 3 - ln(x*y) -> 2
d = -19.330284