C# Online Compiler
Example: Addition of Two Numbers in C# using Function
C
C++
C#
Java
Python
PHP
main.cs
STDIN
Run
// Addition of Two Numbers in C# using Function using System; public class W3CW { // To make the sum of two numbers public static int Sum(int x, int y) { return x + y; } // @It's the driver function static public void Main (string[] args) { Console.WriteLine("Enter two integer values::"); int p = Convert.ToInt32(Console.ReadLine()); int q = Convert.ToInt32(Console.ReadLine()); // It will print the final output Console.Write("\nResult:: " + p + " + " + q + " = " + Sum(p, q)); } }
10 20
Output
Clear
ADVERTISEMENTS