課程
/后端開發(fā)
/C#
/C#開發(fā)輕松入門
if(x==y)
? ? ? ? ? ? ? ? ? ? break;
2018-07-08
源自:C#開發(fā)輕松入門 4-9
正在回答
?for(int i=0;i<7;i++){
? ? ? ? ? for(int j=0;j<7;j++){
? ? ? ? ? ? ? if(i+j==6 || i==j){
? ? ? ? ? ? ? ? ? ? ?Console.Write("O");
? ? ? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? ? ? Console.Write(".");
? ? ? ? ? ? ? ? }?
? ? ? ? ? ?}
? ? ? ? ? ? Console.WriteLine("");
? }
????????static?void?Main(string[]?args) ????????{ ????????????for?(int?y?=?1;?y?<=?7;?y++) ????????????{ ????????????????for?(int?x?=?1;?x?<=?y;?x++) ????????????????{ ????????????????????Console.Write(x); ????????????????} ????????????????Console.WriteLine();//換行 ????????????} ????????}
第二個循環(huán)中間判斷條件改成x<=y就可以了
using?System; using?System.Collections.Generic; using?System.Text;namespace?Test{????class?Program????{????????static?void?Main(string[]?args)????????{????????????for?(int?y?=?1;?y?<=?7;?y++)????????????{????????????????for?(int?x?=?1;?x?<=?y;?x++)????????????????{????????????????????Console.Write(x);????????????????}????????????????Console.WriteLine();//換行????????????}????????}????}}
舉報
本門課程是C#語言的入門教程,將帶你輕松入門.NET開發(fā)
4 回答也可以這樣吧
4 回答為什么我這個也可呀?
3 回答用這些代碼可以不?
2 回答不用真假判斷,也可以嗎?hasNopass在整個程序中有什么重要作用?
1 回答為啥用自減不可以,用自加可以?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學習伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2018-07-09
?for(int i=0;i<7;i++){
? ? ? ? ? for(int j=0;j<7;j++){
? ? ? ? ? ? ? if(i+j==6 || i==j){
? ? ? ? ? ? ? ? ? ? ?Console.Write("O");
? ? ? ? ? ? ? ? }else{
? ? ? ? ? ? ? ? ? ? Console.Write(".");
? ? ? ? ? ? ? ? }?
? ? ? ? ? ?}
? ? ? ? ? ? Console.WriteLine("");
? }
2018-08-08
第二個循環(huán)中間判斷條件改成x<=y就可以了
2018-08-08