Search
 
SCRIPT & CODE EXAMPLE
 

CPP

add two numbers in c#

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);
		}
	}
}
Comment

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
        }
    }
}
Comment

add numbers c#

//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
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: lap trinh file explorer c++ 
Cpp :: the amount of input is unknown 
Cpp :: faster solutions 
Cpp :: i++ i-- 
Cpp :: how to read rotary encoder c++ 
Cpp :: how to find second smallest element in an array using single loop 
Cpp :: no of balanced substrings 
Cpp :: ejemplo 
Cpp :: cplusplusbtutotrail 
Cpp :: gdb get return value of function 
Cpp :: C++ Detect when user presses arrow key 
Cpp :: c++ to mips converter online 
Cpp :: C++ for vs while loops 
Cpp :: check .h files syntax c++ 
Cpp :: https://www.cplusplus.com/doc/tutorial/pointers/ 
Cpp :: C++ Multilevel Inheritance 
Cpp :: multi variable assignment cpp 
Cpp :: c++ reverse bits 
Cpp :: c++ click event 
Cpp :: convert c++ to c language 
Cpp :: std::ifstream cant read file to large 
Cpp :: c++ tuple example 
Cpp :: c++ cash card 
Cpp :: C++ Rectangular Form 
Cpp :: export gcc g++ 
Cpp :: initialise a vector c++ 
Cpp :: C++ operation 
Cpp :: Patrick and Shopping codeforces in c++ 
Cpp :: c++ linker input and output 
Cpp :: c++ static array in Klasse 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =