Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

add numbers c#

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
        }
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #add #numbers
ADD COMMENT
Topic
Name
1+1 =