+ 1

Help me write a program please!

Hello, I am a student and a beginner in programming. I have a task to do and I don't know what to do... Here is the task: Write a program to calculate the value of the function F(x), enter one parameter from the keyboard and set the other as a constant (what to enter from the keyboard and what to choose as a constant is up to the student). All calculated values should be displayed on the screen. Formulas and values: a=t²b; x=a³+√t+b; y=cosx⁵-bsin²x t=6.2; b=1.8 Note: Pay attention to the order in which the calculations are performed and the values of the function elements are found. This is what I tried to write: #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <math.h> int main() { float t, b, a, x, y; printf("Enter the value of t: "); scanf("%lf", &t); const float b = 1.8; a = t * t * b; x = a * a * a + sqrt(t + b); float cos_x = cos(x); float sin_x = sin(x); y = pow(cos_x, 5) - b * pow(sin_x, 2); printf("a = %lf\n", a); printf("x = %lf\n", x); printf("F(x) = y = %lf\n", y); return 0;

13th Sep 2023, 4:15 PM
Рімма Ханіна
Рімма Ханіна - avatar
3 Respuestas
+ 4
Did you post your code in the code section, do that we can see what happens when you run it?
13th Sep 2023, 5:56 PM
ifl
ifl - avatar
0
Hi
15th Sep 2023, 8:12 AM
Waeed Afgan
Waeed Afgan - avatar
0
I'm not sure where your typo is: cosx⁵ is not the same as pow(cos_x,5) Maybe you want cos_(pow(x,5)) sin²x is not the same as pow(sin_x,2) Maybe you want sin_x * sin_x
16th Sep 2023, 8:45 PM
HungryTradie
HungryTradie - avatar