Answer the question
In order to leave comments, you need to log in
Can you help with the scarf?
double b;
const double PI = 3.14159265;
double result2;
Console.WriteLine("1/4 - 1/4(sin(5/2*PI - 8b)) = ...");
Console.WriteLine("Введите b");
b = Convert.ToDouble(Console.ReadLine());
result2 = 1 / 4 - (1 / 4 * Math.Sin((5 / 2 * PI) - (8 * b)));
result2 = Math.Round(result2, 3);
Console.WriteLine("1/4 - 1/4(sin(5/2*PI - 8b)) = " + result2);
Answer the question
In order to leave comments, you need to log in
1 / 4 == 0, because 1 and 4 are integer constants, and when dividing integers, real ones cannot be obtained. If you want a double type, then write 1D / 4D
or like this
result2 = 1.0 / 4.0 - (1.0 / 4.0 * Math.Sin((5.0 / 2.0 * PI) - (8.0 * b)));
First, why do you need a PI variable? There is Math.PI with type double. Farther. Why do you need an extra calculation like 1/4 if you can write 0.25 and replace 5/2 with 2.5?
Further, the output to the screen is not particularly correct. Can be replaced with:
Console.WriteLine( "0.25 - 0.25(sin(2.5*PI - 8b)) ={0} ", result2).
This would be the correct conclusion. Further, it is still necessary to clarify whether this is the whole program or some method. If a method, then typing to the screen in the method is an OOP error.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question