public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
A a = new A();
int res=a.m(2, 5);
Response.Write(res);
}
}
public class A
{
public int m(int x, int y)
{
if(x>2*y)
{
return 2*x+3*y;
}
else if(x>y && x<2*y)
{
return 2*x+y;
}
else if(x==y)
{
return x+y;
}
else if(y>2*x)
{
return 2*y+3*x;
}
else
{
return 2*y+x;
}
}
}
{
protected void Page_Load(object sender, EventArgs e)
{
A a = new A();
int res=a.m(2, 5);
Response.Write(res);
}
}
public class A
{
public int m(int x, int y)
{
if(x>2*y)
{
return 2*x+3*y;
}
else if(x>y && x<2*y)
{
return 2*x+y;
}
else if(x==y)
{
return x+y;
}
else if(y>2*x)
{
return 2*y+3*x;
}
else
{
return 2*y+x;
}
}
}
No comments:
Post a Comment