w3resource

C#: Print the sum of two numbers


C# Sharp Basic: Exercise-2 with Solution

Write a C# Sharp program to print the sum of two numbers.

In mathematics, summation (capital Greek sigma symbol: ∑) is the addition of a sequence of numbers; the result is their sum or total. The numbers to be summed may be integers, rational numbers, real numbers, or complex numbers.

C# sharp Exercises: Print the sum of two numbers

Sample Solution:

C# Sharp Code:

// This is the beginning of the Exercise2 class
public class Exercise2
{
    // This is the main method where the program execution starts
    public static void Main()
    {
        // This line performs addition of 15 and 17 and outputs the result to the console
        System.Console.WriteLine(15 + 17);
    }
}

Sample Output:

32 

Flowchart:

Flowchart: C# Sharp Exercises - Print the sum of two numbers

C# Sharp Code Editor:

Previous: Write a C# Sharp program to print Hello and your name in a separate line.
Next: Write a C# Sharp program to print the result of dividing two numbers.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.