string[] names = new string[]{"景珍","林惠洋","成蓉","洪南昌","龍玉民","單江開","田武山","王三明"};
int[] score = new int[]{90,65,88,70,46,81,100,68};
int sum = 0;
int avg = 0;
foreach(int i in score){
sum = sum+i;
}
avg=sum/8;
int[] score = new int[]{90,65,88,70,46,81,100,68};
int sum = 0;
int avg = 0;
foreach(int i in score){
sum = sum+i;
}
avg=sum/8;
//請完善代碼
for(int x=0;x<7;x++){
for(int y=0;y<7;y++){
if(y==x||(x+y)==6){
Console.Write("o");
}else{
Console.Write(".");
}
}
}
for(int x=0;x<7;x++){
for(int y=0;y<7;y++){
if(y==x||(x+y)==6){
Console.Write("o");
}else{
Console.Write(".");
}
}
}
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)
自己排下