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

Hamzah Iqbal
seal-mask
.a{fill-rule:evenodd;}techdegree
Hamzah Iqbal
Full Stack JavaScript Techdegree Student 11,145 Points

Multiply - what am I doing wrong?

Program.cs(6,17): error CS0501: 'Program.Multiply(double, double)' must declare a body because it is not marked abstract

Program.cs
using System;

class Program
{

    static void Multiply(double first , double second);
    // 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)
    {
        double total = Multiply (2.5 , 2);
            Console.Writeline (answer);
            double total = Multiply (6 , 7); 
        Console.Writeline (answer);
    }

}

1 Answer

Steven Parker
Steven Parker
231,248 Points

The instructions say "Define a Multiply function that accepts two parameters, multiplies them together, and passes the result to Console.WriteLine."

You've defined the function, but you still need the code body (inside braces) that will do the multiply function and write out the result.

And since the function does the output, you won't need to do anything in Main but call it twice.