What will be the output of the following C# code? [code] class maths { public int length; public int breadth; public

Kim Trang

New member
What will be the output of the following C# code?
Code:
 class maths
 {
     public int length;
     public int breadth;
     public maths(int x, int y)
     {
         length = x;
         breadth = y;
         Console.WriteLine(x + y);
     }
     public maths(double x, int y)
     {
         length = (int)x;
         breadth = y;
         Console.WriteLine(x * y);
     }
 }
class Program
{
    static void Main(string[] args)
    {
        maths m = new maths(20, 40);
        maths k = new maths(12.0, 12);
        Console.ReadLine();
    }
}
A. 60, 24
B. 60, 0
C. 60, 144
D. 60, 144.0
 

Tìm kiếm

Back
Top