using System;
namespace Add{
public class Program{
public static int addition(int a, int b){
return (a+b);
}
public static void Main(){
int a,b;
int sum;
Console.Write("Enter first number: ");
a = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter second number: ");
b = Convert.ToInt32(Console.ReadLine());
sum = addition(a,b);
Console.WriteLine("Sum is: " + sum);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Addition
{
public class Program
{
public static void Main(string[] args)
{
int a;
int b;
int add;
Console.WriteLine("Enter Your First Number: "); //allow user input
a = int.Parse(Console.ReadLine()); //convert to answer (string) to int
Console.WriteLine("Enter Your Second Number: ");
b = int.Parse(Console.ReadLine());
add = a + b; //add the input numbers
Console.WriteLine(); //blank space
Console.WriteLine(a + "+" + b + "=" + add); // Print the sum of a + b
Console.WriteLine(); //blank space
}
}
}
//c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Program
{
public class Addition
{
public static void Main(string[] args)
{
int x = 5; //set value for x
int y = 6; //set value for y
int sum;
sum = x + y; //add the numbers
Console.WriteLine(sum); // Print the sum of x + y
}
}
}