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();
}
}
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();
}
}A. 1 1 1
B. 0 0 0
C. 25 100000 12.34
D. -25 -100000 -12.34
Answer: Option C
Related Questions on Classes and Objects in C Sharp
A. A blueprint for creating objects
B. A method in C#
C. A variable in C#
D. A data type in C#
A. A method in C#
B. A variable in C#
C. An instance of a class
D. A data type in C#
A. public
B. private
C. protected
D. internal

Join The Discussion