課程
/后端開發(fā)
/Java
/Java入門第一季(IDEA工具)升級版
? ? ?? *
? ? ***
? *****
*******
每行有七個位置
2018-03-24
源自:Java入門第一季(IDEA工具)升級版 4-4
正在回答
package com.imooc;
public class helloword {
public static void main(String[] args) {
for(int i=0; i<=4;i++) {
for(int j=0;j<i;j++) {
System.out.print(" ");}
for(int k=i+1;k<4;k++) {
System.out.print("*");}
System.out.println();
}
擱淺的魚x 提問者
瓊?cè)A紫英
擱淺的魚x 提問者 回復 瓊?cè)A紫英
把題目中的*換成空格,內(nèi)層循環(huán)再加一個for循環(huán)k從j+1到length,輸出*
瓊?cè)A紫英 回復 擱淺的魚x 提問者
舉報
0基礎(chǔ)萌新入門第一課,從Java環(huán)境搭建、工具使用、基礎(chǔ)語法開始
1 回答Java如何實現(xiàn)星號右對齊?
1 回答數(shù)組的下標是從0開始的,所以循環(huán)是從scores.length -1;開始的。
2 回答怎么看不了視頻??全是文字,從第二章開始
2 回答菱形星星怎么打印
4 回答不是說數(shù)組從零開始嗎??
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-03-24
package com.imooc;
public class helloword {
public static void main(String[] args) {
for(int i=0; i<=4;i++) {
for(int j=0;j<i;j++) {
System.out.print(" ");}
for(int k=i+1;k<4;k++) {
System.out.print("*");}
System.out.println();
}
}
}
2018-03-24
把題目中的*換成空格,內(nèi)層循環(huán)再加一個for循環(huán)k從j+1到length,輸出*