CSharp - Create a class with a method that will return an integer

Requirements

Create a class with a method that will return an integer

This method is used to accept two integer inputs, and in turn, it will return the sum of those integers.

Demo

using System;

class Ex5//from  ww  w . j  av a  2 s  . c o m
{
    public int Sum(int x, int y)
    {
        return x + y;
    }
}

class Program
{
    static void Main(string[] args)
    {
        //A Simple class with a method  returning an integer
        Ex5 ob = new Ex5();
        int result = ob.Sum(57, 63);
        Console.WriteLine("Sum of 57 and 63 is : " + result);
        Console.ReadKey();

    }

}

Result