Answer to Question #309163 in C# for denz

Question #309163

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.



1
Expert's answer
2022-03-10T07:17:06-0500

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);


        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS