Quote:I have tried looking up everything

Did you tried lowercase ?

C#

Copy Code

`using System;`

See more:

C#

Copy Code

Using System; namespace ConsoleApp2 { class Program { static void Main(string[] args) { //Variables needed double a, b, X; //Printing the message and taking input a Console.WriteLine("Enter the value for a: "); a = double.Parse(Console.ReadLine()); //Printing message and taking input b Console.WriteLine("Enter the value for b: "); b = double.Parse(Console.ReadLine()); //Taking the degree value of the BETA Console.WriteLine("Enter the value for BETA: "); int beta = int.Parse(Console.ReadLine()); //Converting into radian by muliplying with PI/180 double betaRad = beta * (Math.PI / 180); //Calculating the numerator of the FORMULA double num = (3 * a) + b; //Calculating denomenator of the formula double denom = Math.Sqrt(a * a * Math.Pow(Math.Sin(betaRad), 2)) - (b * b * Math.Cos(betaRad)); X = num / denom; //Printing the result ROUNDED to two places Console.WriteLine(Math.Round(X,2)); } } }

I have tried looking up everything

Comments

Maybe because it is c# code and not Python.

In addition to what Dave and Patrice have said - C# is case sensitive - the Main method in a Console app must be

Try:

About the only partially useful comment in there is this one:

`public`

, as must the class that contains it.Try:

C#

Copy Code

using System; namespace ConsoleApp2 { public class Program { public static void Main(string[] args) { //Variables needed double a, b, X; //Printing the message and taking input a Console.WriteLine("Enter the value for a: "); a = double.Parse(Console.ReadLine()); //Printing message and taking input b Console.WriteLine("Enter the value for b: "); b = double.Parse(Console.ReadLine()); //Taking the degree value of the BETA Console.WriteLine("Enter the value for BETA: "); int beta = int.Parse(Console.ReadLine()); //Converting into radian by muliplying with PI/180 double betaRad = beta * (Math.PI / 180); //Calculating the numerator of the FORMULA double num = (3 * a) + b; //Calculating denomenator of the formula double denom = Math.Sqrt(a * a * Math.Pow(Math.Sin(betaRad), 2)) - (b * b * Math.Cos(betaRad)); X = num / denom; //Printing the result ROUNDED to two places Console.WriteLine(Math.Round(X,2)); } } }But please, dump the comments. They are useless because they tell us what the code is doing, not why it's doing it. If your comment doesn't add to understanding, it's not worth keeping - in fact it's misleading, as it's unlikely to modified when the code is.

About the only partially useful comment in there is this one:

C#

Copy Code

//Converting into radian by muliplying with PI/180 double betaRad = beta * (Math.PI / 180);And that could be replaced by improving the variable name:

C#

Copy Code

double radiansBeta = beta * (Math.PI / 180);

Comments

Nice catch.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject,
20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8
+1 (416) 849-8900