C# Program that Subtracts two user defined numbers

C# Program that Subtracts two user-defined numbers

C# Program that Subtracts two user defined numbers

Object:

Make a class for subtraction, define a method sub, which subtracts two user-defined numbers. Call it in the main program. C# Projects with Source Code

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lab1b
{
class subtraction
{
public void sub(int a, int b)
{
Console.WriteLine(“Value of a is : ” +(a));
Console.WriteLine(“Value of b is : ” + (b));
Console.WriteLine(“\nSubtraction of Two Numbers is = ” + (a – b));
}
}
class Program
{
static void Main(string[] args)
{
subtraction obj = new subtraction();
obj.sub(5, 3);
Console.ReadKey();
}
}
}

Output:

C# Program that Subtracts two user defined numbers

Another Program: C# Program Calculating the Area of a Rectangle

C++ projects for beginners with source code

M.A Siddiqui

Hi, I am M.A Siddiqui. I'm a Computer Science Student, In this website, I'm teaching you Multiple languages and provides Projects and other Subjects Notes.

You may also like...

6 Responses

  1. July 27, 2020

    […] Another Program: C# Program that Subtracts two user-defined numbers […]

  2. August 16, 2020

    […] Another C# Program: C# Program that Subtracts two user-defined numbers […]

  3. August 25, 2020

    […] Another C# Program: C# Program that Subtracts two user-defined numbers […]

  4. September 3, 2020

    […] Another C# Program: C# Program that Subtracts two user-defined numbers […]

  5. September 4, 2020

    […] Another C# Program: C# Program that Subtracts two user-defined numbers […]

  6. September 4, 2020

    […] Another Program: C# Program that Subtracts two user-defined numbers […]

Leave a Reply

Your email address will not be published. Required fields are marked *