Multiply 2 numbers but add a condition to it?

  • Thread starter Thread starter Zivanovic
  • Start date Start date
Z

Zivanovic

Guest
Hello,

I have a quite simple question(new to all of this).

I've made a console program that multiplies two user input numbers, here's the code :

Console.WriteLine("Enter the first number");
var first_number = decimal.Parse(Console.ReadLine());

Console.WriteLine("Enter the second number");
var second_number = decimal.Parse(Console.ReadLine());

Console.WriteLine("Answer:\n");
Console.WriteLine(first_number * second_number);

My question is, how can I make a condition that the user can't use anything else than numbers?

Thanks.

Continue reading...
 
Back
Top