Answer the question
In order to leave comments, you need to log in
A simple C program throws an error. How to fix?
#include math.h
#include stdio.h
#include stdlib.h
# define M_PI 3.14159265358979323846 /* pi */
main()
{
double a,
b,
x,
z;
system("cls");
printf("Введите значение параметра a: ");
scanf("%f",&a);
printf("Введите значение параметра b: ");
scanf("%f",&b);
printf("Введите значение аргумента x: ");
scanf("%f",&x);
if (x<=a) (4.1 + (7*pow(x,2)) + sin((8.2 * x) + (M_PI/6)));
else if (a>x>b) (sqrt(pow(cos,2)*pow(atan,2)*pow(x,2)+pow(exp,(3*x+10)))));
else if ((x>=b) (log(asin(x)+acos(x)+pow(x,3.2)));
printf("Значение функции z = %e\n",z);
return 0;
}
Answer the question
In order to leave comments, you need to log in
Here the whole program is full of errors to the very eyeballs.
main()
?scanf("%f",&b)
the format used %f
? What format should be used to enter values of type double
?if (a>x>b)
?pow(cos,2)
: What is this one doing there cos
?if ((x>=b)
?if
that seem to calculate something, but do not save the results of their calculations anywhere? That is, they actually do nothing. Why are they needed?printf
at the end prints the value of the variable z
. But you haven't assigned any value to this variable.Including header files should be like this:
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
z
this is a variable, not a function, also remember that double and float are different types.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question