# Questioncalculate two numbers

#### Tsukeo

##### New member
Hi. I started last week trying to learn C#, and think I've gotten a good way already. I learned about classes today! I plan on one day being a game developer. Anyway, I need some help with a calculator I tried to make in Command Console(?), when I type in the two numbers, it won't calculate, the answer is blank!
Can someone help me? (Sorry if this seems like a stupid question.)

C#:
``````using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication9
{
class Program
{
static void Main(string[] args)
{

int numberOne = Convert.ToInt32(numOne);
int numberTwo = Convert.ToInt32(numTwo);

Console.WriteLine("+, -, / or *?");

switch (method)
{
case "+":
Plus(numberOne, numberTwo);
break;
case "-":
Minus(numberOne, numberTwo);
break;
break;
case "*":
Multiply(numberOne, numberTwo);
break;
case "/":
Division(numberOne, numberTwo);
break;
default:
Console.WriteLine("Error!");
break;
}
}

static int Multiply(int a, int b)
{
int answer = a * b;
}

static int Minus(int a, int b)
{
int answer = a - b;
}

static int Plus(int a, int b)
{
int answer = a + b;
}

static double Division(int a, int b)
{
if (a == 0) // This is just so that I won't get an error!
{
return 0;
}
else if (b == 0)
{
return 0;
}
else
{
double answer = a / b;
}

}
}
}``````

You're never actually writing out the answer. You call one of your calculation methods and they return the result but you never actually use that result. You have to call Console.WriteLine to write that result out so the user can see it.

Thank you! I added a 'Console.WriteLine' to each of the switch-cases, and it worked! Replies
4
Views
384
Replies
1
Views
267
Replies
2
Views
230
Replies
7
Views
1K
Replies
16
Views
846