I am teaching myself c# with the help of a few books and I got curious so I tried building a small console app to get two numbers from user add them together and using an if else statement depending on the result print one of the messages but my code asks for the second number and prints the else statement and the press any key to continue all at the same time without getting my second number or doing the math
using System;
namespace helloworldwcond
{
class Program
{
public static void Main(string[] args)
{
int a;
int b;
int c;
Console.Write("Enter a Number: ");
a = Console.Read ();
Console.Write ("Enter another Number: ");
b = Console.Read ();
c = a + b;
if (c == 7) {
Console.WriteLine("Hello World!");
} else {
Console.Write("We Are DOOMED");
}
// TODO: Implement Functionality Here
Console.Write ("Press any key to continue . . . ");
Console.ReadKey (true);
}
}
}