int x = 1;
int sum = 0;//和,初始化为0
while (x <= 30)//循环条件
{
if (x%2!=0)//筛选条件
sum += x;
x++;
}
Console.Write("1-30奇数的和:"+sum);
int sum = 0;//和,初始化为0
while (x <= 30)//循环条件
{
if (x%2!=0)//筛选条件
sum += x;
x++;
}
Console.Write("1-30奇数的和:"+sum);
2017-10-16
string[] names = new string[]{"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昆","关欣"};
int[] scores = {89,90,98,56,60,91,93,85};
int max = 0;
string name = "";
for(int i=0;i<scores.Length;i++){
if(scores[i]>max){
max = scores[i];
name = names[i];
}
}
Console.Write("分数最高的是{0},分数是{1}",name, max);
int[] scores = {89,90,98,56,60,91,93,85};
int max = 0;
string name = "";
for(int i=0;i<scores.Length;i++){
if(scores[i]>max){
max = scores[i];
name = names[i];
}
}
Console.Write("分数最高的是{0},分数是{1}",name, max);
string[] job = new String[4];
job[0] = "经理";
job[1] = "项目主管";
job[2] = "技术总监";
job[3] = "财务主管";
for (int i = 0; i < 4 ; i++)
{
Console.Write(job[i]);//打印职位
}
job[0] = "经理";
job[1] = "项目主管";
job[2] = "技术总监";
job[3] = "财务主管";
for (int i = 0; i < 4 ; i++)
{
Console.Write(job[i]);//打印职位
}
2017-10-14
已采纳回答 / Allen_Qiu
因为这是Console对象write方法的两个实际参数,参数间用逗号隔开,当然你也可以用Console.Write("我的工资奖金总额是"+(salary+prize)+"元");
2017-10-13