try this:
Console.Write("The sum of " + number1 + " and " + number2 + " is " + total +".");
You need the +
operator to concatenate string together.
Question
I am trying to get the sum of two numbers, but it is not displaying correctly. Here is the code:
int number1 = 1;
int number2 = 3;
Console.Write("The sum of " number1 "and" number2 "is" total ".");
La solution 2
try this:
Console.Write("The sum of " + number1 + " and " + number2 + " is " + total +".");
You need the +
operator to concatenate string together.
Autres conseils
Try this:
Console.Write("The sum of {0} and {1} is {2}.", number1, number2, total);