ExamVeda
Login
Home
Classes and Objects in C Sharp
?

What will be the output of the following C# code?
class maths
{
    public int fun(int ii)
    {
        return(ii > 0 ? ii :ii * -1);
    }
    public long fun(long ll)
    {
        return(ll > 0 ? ll :ll * -1);
    }
    public double fun( double dd)
    {
        return(dd > 0 ? dd :dd * -1);
    }
}    
class Program
{
    static void Main(string[] args)
    {
        maths obj = new maths();
        int i = -25;
        int j ;
        long l = -100000l ;
        long m;
        double d = -12.34;
        double e;
        j = obj.fun(i);
        m = obj.fun(l);
        e = obj.fun(d);
        Console.WriteLine(j + "  " + m + "  " + e);
        Console.ReadLine();
    }
}

Answer & Solution
Correct Answer: Option C
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.