Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to Program in C# - Variables

I'm not able to solve the challenge at the end and I can't find the answer on the site.

Answers

  • edited January 11

    Hello snorx,

    Links to the answers are always under the YouTube recs. In this case, the official answer is https://bit.ly/2Vdf5li

    ```

    Console.WriteLine("Please provide 3 numbers and we will check what is the average of it. \nPlease provide a first number: ");


          // We are declaring and get a first variable here:

          double x = Convert.ToDouble(Console.ReadLine());


          Console.WriteLine("Provide a second number please: ");


          // We are declaring and get a second variable:

          double y = Convert.ToDouble(Console.ReadLine());


          Console.WriteLine("Provide a third number please: ");


          // We are declaring and get a third variable:

          double z = Convert.ToDouble(Console.ReadLine());


          // We are doing math here and checking what is the average:

          double result = (x + y + z) / 3;


          // We are displaying our result here:

          Console.WriteLine("We got this. The average number is: " + result);


          // Wait before closing

          Console.ReadKey();

    ```

Sign In or Register to comment.