C#: Print the sum of two numbers
C# Sharp Basic: Exercise-2 with Solution
Sum of Two Numbers
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.
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:
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.
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/csharp-exercises/basic/csharp-basic-exercise-2.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics