Wednesday, 4 March 2015

//Write a program to create an interface and display maximum value using three variables.
using System;
interface myinterface
{
    string getdata(int a, int b, int c);
}
class b : myinterface
{
    public string getdata(int a, int b, int c)
    {
        if (a > b && a > c)
            return "A is Max";
        else if (b > c && b > a)
            return "B is Max";
        else if (c > a && c > b)
            return "C is Max";
        else if (a == b && a > c)
            return "A  & B is Max";
        else if (b == c && b > a)
            return "B  & C is Max";
        else if (c == a && c > b)
            return "C  & A is Max";
        else
            return "A & B & C Are Max";
    }
}
class myclass
{
    public static void Main()
    {
        int a, b, c;
        Console.Write("enter values of a : ");
        a = Convert.ToInt32(Console.ReadLine());
        Console.Write("enter values of b : ");
        b = Convert.ToInt32(Console.ReadLine());
        Console.Write("enter values of c : ");
        c = Convert.ToInt32(Console.ReadLine());
        b b1 = new b();
        Console.WriteLine(b1.getdata(a,b,c));
        Console.Read();
    }
}

No comments:

Post a Comment