最赞回答 / Gaohay
using System; using System.Collections.Generic; using System.Text; namespace sushu {
class Program
{
static void Main(string[] args)
{
int m, n, i, t;
Console.WriteLine("请输入第一个整数:");
...
2017-01-31
namespace Test
{
class Program
{
static void Main(string[] args)
{
for (int x = 1; x < 10; x++)
{
if(x!=3&&x!=8)//请添加代码,过滤3和8
Console.Write(x);
}
}
}
}
{
class Program
{
static void Main(string[] args)
{
for (int x = 1; x < 10; x++)
{
if(x!=3&&x!=8)//请添加代码,过滤3和8
Console.Write(x);
}
}
}
}
2017-01-31
在内层加一行else;就OK,目的是使原本的else与上面那个匹配,那么只要弄个else;与第二个匹配就行,;是因为不需要执行块
if (x >= y)
if (x >= 5)
Console.WriteLine("5");
else;
else
if (y >= 6)
Console.WriteLine("6");
else
Console.WriteLine("7");
if (x >= y)
if (x >= 5)
Console.WriteLine("5");
else;
else
if (y >= 6)
Console.WriteLine("6");
else
Console.WriteLine("7");
2017-01-30
int[] num = {89,90,98,56,60,91,93,85};
string[] y = { "吴松","钱东宇","伏晨","陈路","周蕊","林日鹏","何昆","关欣" }
int max = num[0];
int index = 0;
for(int i = 0; i < num.GetLength(0); i++)
if(max < num[i])
max = num[i];
index = i;
int dex = 0;
for (int q = 0; q < y.GetLength(0); q++)
dex = q;
if (index == dex)
自己排下
string[] y = { "吴松","钱东宇","伏晨","陈路","周蕊","林日鹏","何昆","关欣" }
int max = num[0];
int index = 0;
for(int i = 0; i < num.GetLength(0); i++)
if(max < num[i])
max = num[i];
index = i;
int dex = 0;
for (int q = 0; q < y.GetLength(0); q++)
dex = q;
if (index == dex)
自己排下
bool t = false;
foreach (int a in num)//请完善代码,判断数组中有没有7的整倍数
{
if (a % 7 == 0)
{
t = true;
break;
}
}
String u = t ? "a" : "没有7的整倍数";
Console.WriteLine(u);
foreach (int a in num)//请完善代码,判断数组中有没有7的整倍数
{
if (a % 7 == 0)
{
t = true;
break;
}
}
String u = t ? "a" : "没有7的整倍数";
Console.WriteLine(u);
最赞回答 / qq_白板_2
如果int a,b,c;a=1;b=a++;c=++a;Console.WriteLine("a");Console.WriteLine("b");Console.WriteLine("c");b=1c=2a=2 意思是a++,++a都会使a加1,但是++a会先加1再输出,而a++会先输出再加1
2017-01-26