Answers for "c# function to add numbers"

C#
3

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);
		}
	}
}
Posted by: Guest on August-28-2021
1

function in c# to do addition

int a = 80;
int b = 20;
int addition(int number1, int number2)
{
	int result = number1 + number2;
	return result;
}
Console.WriteLine(addition( a,  b));
Posted by: Guest on October-01-2021

Code answers related to "c# function to add numbers"

C# Answers by Framework

Browse Popular Code Answers by Language