Write a console application that uses at least five (5) different methods of Math class. Provide a meaningful identifier of the variables or constants. Name the namespace as MathApp and its class as MathProgram.
I wrote a program that calculates different values of a variable y:
namespace MathApp
{
internal class MathProgram
{
static void Main(string[] args)
{
double x;
x = Int32.Parse(Console.ReadLine());
double y0 = Math.Pow((x / 7 - 1), 2);
double y1 = 1 / (7 * Math.Abs(x / 7 - 1));
double y2 = Math.Cos(Math.Pow(x, 2));
double y3 = Math.Pow((x / 7 - 1), 2) + (1 / (7 * Math.Abs(x / 7 - 1))) + Math.Cos(Math.Pow(2, x));
double y4 = (Math.Cos(Math.Log((Math.Sqrt(Math.Abs(x))) + Math.Abs(x)))) / (3 * Math.Sqrt(Math.Abs(x)));
double y5 = (Math.Cos((Math.Log((Math.Sqrt(Math.Abs(x))) + Math.Abs(x)))) / (3 * Math.Sqrt(Math.Abs(x)))) + (1 / (3 * Math.Log(Math.Sqrt(Math.Abs(x)) + Math.Abs(x))));
Console.WriteLine("y0 = " + y0);
Console.WriteLine("y1 = " + y1);
Console.WriteLine("y2 = " + y2);
Console.WriteLine("y3 = " + y3);
Console.WriteLine("y4 = " + y4);
Console.WriteLine("y5 = " + y5);
}
}
}
Comments
Leave a comment