Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Basics Methods Method Parameters

Thomas Lorenz
PLUS
Thomas Lorenz
Courses Plus Student 825 Points

Multiply

Why is my code returning 560.88 but it still says it is correct?

Program.cs
using System;

class Program
{
    static void Multiply(double first, double second)
    {
        double total = first * second;
        Console.WriteLine(total);
    }

    // YOUR CODE HERE: Define a method named Multiply. Remember
    // to use the "static" and "void" keywords: "static void
    // Multiply" (without quotes). Multiply should take two
    // "double" values as parameters.

    static void Main(string[] args)
    {
        Multiply(2.5,2);
        Multiply(6,7);
        // YOUR CODE HERE:
        // Call Multiply with two arguments: 2.5 and 2.
        // YOUR CODE HERE:
        // Call Multiply with two arguments: 6 and 7.
    }

}

1 Answer

Steven Parker
Steven Parker
231,268 Points

"Pay no attention to that man behind the curtain!" :laughing:

The challenges often use internal procedures and data to test code more thoroughly than you might expect, and of course they check the accuracy of those results as well. We can guess you are seeing the result of one of those extra tests.