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

C# basics

Program.cs
using System;

class Program
{

    static void Multiply(double firstParameter, double secondParameter)
{
        return firstParameter + secondParameter;
}


    static void Main(string[] args)
    {
        double total = multiply(2.5, 2);
        Console.WriteLine(total);
        double remaining = multiply(6, 7);
        Console.WriteLine(remaining);


        // YOUR CODE HERE:
        // Call Multiply with two arguments: 2.5 and 2.
        // YOUR CODE HERE:
        // Call Multiply with two arguments: 6 and 7.
    }

}

2 Answers

What exactly are you asking here? Are you having trouble with the coding challenge?

Well, first off you were adding it and you need to multiply it, second off you cannot return when the method is a void.

So I have changed the code and this should work.

using System;

class Program
{

    static double Multiply(double firstParameter, double secondParameter)
{
        return firstParameter * secondParameter;
}


    static void Main(string[] args)
    {
        Console.WriteLine(Multiply(2.5, 2));
        Console.WriteLine(Multiply(6, 7));
    }

}