for (int x = 1; x < 10; x++)
{
if(x==3||x==8)//请添加代码,过滤3和8
continue;
Console.Write(x);
}
{
if(x==3||x==8)//请添加代码,过滤3和8
continue;
Console.Write(x);
}
2018-03-19
static void Main(string[] args)
{
int year = 2015;//年份
string text;
text=year%4==0?"闰年":"平年";//请填写代码
Console.WriteLine("今年是{0}",text);
}
{
int year = 2015;//年份
string text;
text=year%4==0?"闰年":"平年";//请填写代码
Console.WriteLine("今年是{0}",text);
}
2018-03-19
第一个想到的是这样写:
int x=1,sum=0;
while(x<=30){
sum=sum+x;
x+=2;
}
Console.WtireLine(sum);
int x=1,sum=0;
while(x<=30){
sum=sum+x;
x+=2;
}
Console.WtireLine(sum);
2018-03-19
static void Main(string[] args)
{
int x=1;
bool a = ++x * x > 3;
bool b = ++x * x > 3;//请赋值
Console.WriteLine(a==b);
}
{
int x=1;
bool a = ++x * x > 3;
bool b = ++x * x > 3;//请赋值
Console.WriteLine(a==b);
}
2018-03-19
static void Main(string[] args)
{
int num1 = 5;//第一个加数
int num2 = 7;//第二个加数
int sum=num1+num2;//求和
Console.WriteLine("和是{0}",sum);//打印结果
}
{
int num1 = 5;//第一个加数
int num2 = 7;//第二个加数
int sum=num1+num2;//求和
Console.WriteLine("和是{0}",sum);//打印结果
}
2018-03-19
double d = 2.5;
int x = 2 + 1;
Console.WriteLine(x);
Program.cs(11,20): warning CS0219: The variable `d' is assigned but its value is never used
Compilation succeeded - 1 warning(s)
3
int x = 2 + 1;
Console.WriteLine(x);
Program.cs(11,20): warning CS0219: The variable `d' is assigned but its value is never used
Compilation succeeded - 1 warning(s)
3
2018-03-19
sum += score[i]; }
avg = sum/score.Length;
Console.Write("平均分是"+ avg + ",");
Console.WriteLine("高于平均分的有:");
for(int j = 0; j < name.Length; j++)
{
if(score[j] > avg)
Console.Write(name[j] + " ");
avg = sum/score.Length;
Console.Write("平均分是"+ avg + ",");
Console.WriteLine("高于平均分的有:");
for(int j = 0; j < name.Length; j++)
{
if(score[j] > avg)
Console.Write(name[j] + " ");