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 trialSysteembeheer PeoplePower
1,424 PointsC# basics
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
Alejandro ponce
709 PointsWhat exactly are you asking here? Are you having trouble with the coding challenge?
Marcus Pedersen
3,485 PointsWell, 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));
}
}