求在座的各位大神幫忙解惑
uj5u.com熱心網友回復:
Console.WriteLine(" * ");
Console.WriteLine(" *** ");
Console.WriteLine("*****");
uj5u.com熱心網友回復:
錯了,應該是
Console.WriteLine(" ** ");
Console.WriteLine(" **** ");
Console.WriteLine("******");
uj5u.com熱心網友回復:
Console.WriteLine("******");
Console.WriteLine(" **** ");
uj5u.com熱心網友回復:
for(){
for()
{
}
}
uj5u.com熱心網友回復:
必須要用回圈陳述句來實作
uj5u.com熱心網友回復:
必須要用回圈陳述句來實作
uj5u.com熱心網友回復:
Console.WriteLine(" * ");
Console.WriteLine(" *** ");
Console.WriteLine("*****");
錯了,應該是
Console.WriteLine(" ** ");
Console.WriteLine(" **** ");
Console.WriteLine("******");
必須要用回圈陳述句來實作
uj5u.com熱心網友回復:
就是一三五七九啊。回圈的時候每次加二不就完事了,還有特別的要求么uj5u.com熱心網友回復:
string str = "";
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 6; j++)
{
if (j >= 3 - i-1 & j <= i + 3)
{ str += "*"; }
else
{ str += " "; }
}
Console.WriteLine(str);
str = "";
}
Console.ReadLine();
這個應該不算答案,但是這個能實作
我覺得我這個寫的很弟弟
uj5u.com熱心網友回復:
string str = "";
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 6; j++)
{
if (j >= 3 - i-1 & j <= i + 3)
{ str += "*"; }
else
{ str += " "; }
}
Console.WriteLine(str);
str = "";
}
Console.ReadLine();
這個應該不算答案,但是這個能實作
我覺得我這個寫的很弟弟
這個肯定不會合格的
uj5u.com熱心網友回復:
就是一三五七九啊。回圈的時候每次加二不就完事了,還有特別的要求么
有一共要五行
第一行要有9個*
第五行要有25個*
uj5u.com熱心網友回復:
你要的是等腰梯形吧uj5u.com熱心網友回復:
你要的是等腰梯形吧
嗯嗯嗯嗯
是的大神
有代碼嗎
uj5u.com熱心網友回復:
你要的是等腰梯形吧
有一共要五行
第一行要有9個*
第五行要有25個*
uj5u.com熱心網友回復:
你先想想用倒的25,21,17,13每次少四個
0,2,4,6每次+兩個空
uj5u.com熱心網友回復:
你先想想用倒的
25,21,17,13每次少四個
0,2,4,6每次+兩個空
跪求大神解答拜托拜托
uj5u.com熱心網友回復:
/// <summary>/// 輸出梯形
/// </summary>
/// <param name="rows">行數</param>
/// <param name="beginNum">開始數量</param>
/// <param name="endNum">結束數量</param>
private static void ConsoleTrapezoid(int rows, int beginNum, int endNum)
{
int addQty = (endNum - beginNum) / (rows - 1);//每次增量
//回圈行數
for (int i = 0; i < rows; i++)
{
int rowNum = beginNum + i * addQty;//當前行星星數
//回圈輸出空格
for (int j = 0; j < (endNum - rowNum) / 2; j++) {
Console.Write(" ");
}
//回圈輸出星星
for (int j = 0; j < rowNum; j++)
{
Console.Write("*");
}
Console.WriteLine("");
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/79108.html
標籤:C#
