public Double print(int num)
{
Double price=0;
if(num<仿源=100)
{
price =Convert.ToDouble( num * 0.5);
return price;
}
price = Convert.ToDouble(100 * 0.5 + (num - 100) * 0.3);
return price;
}
在你备野态脊银按纽下面调用这个方法
label1.Text= print(Convert.ToInt32(textBox1.Text)).ToString();
public static void main(String[] args){
int num=Integer.parse(Console.ReadLine());
int rest=num-100;
int sum=0.5*num+(rest>0?rest:0)*(0.5-0.3);
Console.WriteLine(sum);
}