关卡数分数代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1关卡数
{
class Program
{
static void Main(string[] args)
{
Console.Write("输入你现在的关卡数:");
int n = int.Parse(Console.ReadLine());
int sum = 0;
if(n>0&&n<=50)
{ for (int i=1;i<=n ;i++ )
{if(i<=20)
{
sum+=i;
}else if(i>=20&&i<=30)
{
sum+=10;
}else if(i>30&&i<=40)
{
sum+=20;
}else if(i>40&&i<=49)
{
sum+=30;
}else{sum+=100;
}
}
}else
{
Console.WriteLine("输入无效,请重新输入!");
}
Console.WriteLine("您当前拥有的分数:"+sum);
Console.ReadLine();
}
}
}