Create a component that receives two numbers from the user through a Web Form, and
based on the user’s selection it adds or subtracts the two numbers and returns the result to
the Web Form. The result should be displayed in the Web Form.
using System;
class HelloWorld {
static void Main() {
Console.WriteLine("Enter first number:");
int x = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Enter second number:");
int y = Convert.ToInt32(Console.ReadLine());
int sum = x + y;
int sub = x-y;
Console.WriteLine(sum);
Console.WriteLine(sub);
}
}
Comments
Leave a comment