Skip to content
This repository has been archived by the owner on Sep 27, 2020. It is now read-only.

Added a c# snippet for adding 2 numbers. #97

Merged
merged 1 commit into from
Oct 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions C#/add2Numbers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;

public class functionexcercise
{
public static int Sum(int num1, int num2)
{
int total;
total = num1 + num2;
return total;
}

public static void Main()
{
Console.Write("Enter two numbers: ");
int number1 = Convert.ToInt32(Console.ReadLine());
int number2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("\nThe sum of two numbers is : {0} \n", Sum(number1, number2));

Console.ReadLine();
}
}