using System;
namespace Test
{
class Program
{
static void Main(string[] args)
{
string[] a = { "關(guān)羽", "張飛", "趙云", "馬超", "黃忠" };
foreach (var i in a)
{
Console.Write(i+",");
}
}
}
}
namespace Test
{
class Program
{
static void Main(string[] args)
{
string[] a = { "關(guān)羽", "張飛", "趙云", "馬超", "黃忠" };
foreach (var i in a)
{
Console.Write(i+",");
}
}
}
}
2021-02-22
bool has7Bei=false;
foreach(int x in num){
if(x%7==0){
has7Bei=true;
break;
}
}
if(has7Bei)
Console.Write("有七的倍數(shù)");
else
Console.Write("沒(méi)有7的整倍數(shù)");
foreach(int x in num){
if(x%7==0){
has7Bei=true;
break;
}
}
if(has7Bei)
Console.Write("有七的倍數(shù)");
else
Console.Write("沒(méi)有7的整倍數(shù)");
2021-02-18
for (int y = 1; y <= 7; y++)
{
for (int x = 1; x <= 7; x++)
{
Console.Write(x);
if(x>y-1)
break;
}
Console.WriteLine();//換行
}
{
for (int x = 1; x <= 7; x++)
{
Console.Write(x);
if(x>y-1)
break;
}
Console.WriteLine();//換行
}
2021-02-17
for (int y = 1; y <= 7; y++)
{
for (int x = 1; x <= y; x++)
{
Console.Write(x);
}
Console.WriteLine();//換行
}
{
for (int x = 1; x <= y; x++)
{
Console.Write(x);
}
Console.WriteLine();//換行
}
2021-02-08
{ if (x >= 5) {Console.WriteLine("5" }else { if (y >= 6) { Console.WriteLine("6"); }else
{
Console.WriteLine("7");
}
}
}
else
{
Console.WriteLine("6");
}
{
Console.WriteLine("7");
}
}
}
else
{
Console.WriteLine("6");
}
2021-01-28
bool hasno=false;
for(int i=0;i<num.Length;i++)
{
if(num[i]%7==0)
hasno=true;
}
if(hasno)
{Console.Write("有7的整倍數(shù)");
}
else
{
Console.Write("沒(méi)有7的整倍數(shù)");
for(int i=0;i<num.Length;i++)
{
if(num[i]%7==0)
hasno=true;
}
if(hasno)
{Console.Write("有7的整倍數(shù)");
}
else
{
Console.Write("沒(méi)有7的整倍數(shù)");
2021-01-16
//請(qǐng)完善代碼,判斷數(shù)組中有沒(méi)有7的整倍數(shù)
bool hasSeven = false;
foreach (int temp in num) {
hasSeven = temp % 7 == 0 ? true : false ;
if(hasSeven)
break;
}
Console.Write(hasSeven ? "有7的整倍數(shù)" : "沒(méi)有7的整倍數(shù)");
bool hasSeven = false;
foreach (int temp in num) {
hasSeven = temp % 7 == 0 ? true : false ;
if(hasSeven)
break;
}
Console.Write(hasSeven ? "有7的整倍數(shù)" : "沒(méi)有7的整倍數(shù)");
2020-11-04
直接改成Console.WriteLine(true);也行...系統(tǒng)只檢查最后輸出內(nèi)容,不管中間過(guò)程合理不合理
2020-11-02