第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

怎么將直角的變成等腰三角形三角形

public class HelloWorld {

? ? public static void main(String[] args) {

? ? ? ??

System.out.println("打印直角三角形");

? ? ? ??

// 外層循環(huán)控制行數(shù)

for (int i = 1; ?i<=3; i++) {

? ? ? ? ? ??

// 內(nèi)層循環(huán)控制每行的*號(hào)數(shù)

// 內(nèi)層循環(huán)變量的最大值和外層循環(huán)變量的值相等

for (int j = 1; ?j<=i ?; j++ ) {

? ? ? ? ? ? ? ??

System.out.print("*");

}

? ? ? ? ? ??

// 每打印完一行后進(jìn)行換行

System.out.println();

}

}

}


正在回答

7 回答

public class HelloWorld {

? ? public static void main(String[] args) {

? ? ? ? System.out.println("打印等腰三角形");

? ? ? ? // 外層循環(huán)控制行數(shù)

? ? ? ? for (int i = 1; ?i<=3; i++) {

? ? ? ? for (int j = 1; ?j<=(3-i) ?; j++ ) {

? ? ? ? ? ? ? ? System.out.print(" ");

? ? ? ? ? ? ? ? }??

? ? ?// 內(nèi)層循環(huán)控制每行的*號(hào)數(shù)

? ? ? ? for(int k=(4-i);k<=(i+2);k++){

? ? ? ? System.out.print("*");

? ? ? ? ? ?}

? ? ? ? ? ? // 每打印完一行后進(jìn)行換行

? ? ? ? System.out.println();

? ? ? ? }

? ? ? ? }

? ? }


2 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qtls123 提問者

非常感謝!
2016-03-17 回復(fù) 有任何疑惑可以回復(fù)我~
#2

qtls123 提問者

貌似不是等腰的不過思路對(duì)
2016-03-17 回復(fù) 有任何疑惑可以回復(fù)我~
#3

qtls123 提問者

是等腰的,剛測(cè)試完,對(duì)
2016-03-17 回復(fù) 有任何疑惑可以回復(fù)我~
#4

noob_

是對(duì)的,但是看不懂~~~~
2016-04-15 回復(fù) 有任何疑惑可以回復(fù)我~
#5

超音速蝸牛

邏輯是對(duì)的,但能解釋下“3-i”和“4-i”是怎么得來的嗎?謝謝!
2017-06-01 回復(fù) 有任何疑惑可以回復(fù)我~
查看2條回復(fù)

public class HelloWorld {

? ? public static void main(String[] args) {

? ? ? ? System.out.println("打印等腰三角形");

? ? ? ? for(int i=1;i<=3;i++){

? ? ? ? ? ? for(int j=1;j<=3-i;j++){

? ? ? ? ? ? ? ? System.out.print(" ");

? ? ? ? ? ? }

? ? ? ? ? ? ? ? for(int k=1;k<=2*i-1;k++){

? ? ? ? ? ? ? ? ? ? System.out.print("*");

? ? ? ? ? ? ? ? }

? ? ? ? ? ? System.out.println();

? ? ? ? }

? ? }

}


0 回復(fù) 有任何疑惑可以回復(fù)我~

System.out.println("打印等邊三角形:");

for(int i = 1; i <=3; i++){

for(int j = i; j <= 2; j++){

System.out.print(" ");

}

for(int k = 1;k <= i; k++){

System.out.print(" *");

}

System.out.println();

}


0 回復(fù) 有任何疑惑可以回復(fù)我~

我試了下可以,但是思路還是很不清晰,誰可以解釋下嗎,特別是j<=3-i,后面

? ? ? ? System.out.print("*");

? ? ? ? System.out.print(" ")

還有這兩個(gè)的意思是先輸出*在輸出空白循環(huán)嗎,不太理解

0 回復(fù) 有任何疑惑可以回復(fù)我~

這是等邊的:

public class HelloWorld {

? ? public static void main(String[] args) {

? ? ? ? System.out.println("打印等邊三角形");

? ? ? ? // 外層循環(huán)控制行數(shù)

? ? ? ? for (int i = 1; ?i<=3; i++) {

? ? ? ? for (int j = 1; ?j<=3-i ; j++ ) {

? ? ? ? ? ? ? ? System.out.print(" ");

? ? ? ? ? ? ? ? } ?

? ? ?// 內(nèi)層循環(huán)控制每行的*號(hào)數(shù)

? ? ? ? for(int k=1;k<=i;k++){

? ? ? ? System.out.print("*");

? ? ? ? System.out.print(" ");

? ? ? ? ? ?}

? ? ? ? ? ? // 每打印完一行后進(jìn)行換行

? ? ? ? System.out.println();

? ? ? ? }

? ? ? ? }

? ? }


0 回復(fù) 有任何疑惑可以回復(fù)我~

public class HelloWorld {

? ? public static void main(String[] args) {


for (int i = 1; i<=3 ?;i++ ? ? ? ? ? ) {//控制行數(shù) ?

? ? ? ? ? ??

for (int a = 3; a>i ?; ?a-- ? ? ? ?) {//控制空白

? ?System.out.print(" ");

}

for (int j = 1; j<=i ?; ?j++ ? ? ? ?) {//控制* ?

? ? ? ? ? ? ? ??

System.out.print(" *");

}

? ? ? ? ? ??

System.out.println();

}

}

}


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qtls123 提問者

謝謝!
2016-03-17 回復(fù) 有任何疑惑可以回復(fù)我~

public class HelloWorld{

? ? public static void main(String[] args) {

for(int i=1;i<=3;i++){

for(int k=1;k<=3-i;k++){

System.out.print(" ");

}

for(int j=1;j<=2*i-1;j++){

System.out.print("*");

}

System.out.println("");

}

}

}


0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qtls123 提問者

謝謝!
2016-03-17 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
Java入門第一季(IDEA工具)升級(jí)版
  • 參與學(xué)習(xí)       1167326    人
  • 解答問題       18530    個(gè)

0基礎(chǔ)萌新入門第一課,從Java環(huán)境搭建、工具使用、基礎(chǔ)語法開始

進(jìn)入課程

怎么將直角的變成等腰三角形三角形

我要回答 關(guān)注問題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)