java循環(huán)例題 Java中用for循環(huán)如何輸出菱形?
Java中用for循環(huán)如何輸出菱形?*有很多方法可以從I=0開(kāi)始!我將從1開(kāi)始,公共類(lèi)zuoye{public static void main(string[]args){//首先,我認(rèn)為菱形是頂部
Java中用for循環(huán)如何輸出菱形?
*有很多方法可以從I=0開(kāi)始!我將從1開(kāi)始,公共類(lèi)zuoye{public static void main(string[]args){//首先,我認(rèn)為菱形是頂部和底部,頂部5和底部4,所以第一個(gè)for有5次,第二個(gè)for有4次。對(duì)于(int I=1I=2*I-1k--)//*7 5 3 1,基數(shù)倒置系統(tǒng)打印("*") 系統(tǒng)輸出打印希望您能舉一反三,打印實(shí)時(shí)鉆石
//Include<<;test the following<;test the following<;test the following<;test the following<;test the following<;test the following<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試以下<;測(cè)試<;test the>;test the>;test the>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;>;printf()n “)}Printf(”n “)}int main(){int num=0//僅指scanf的上半部分(%d”,&num)fun(num)return 0}這是一個(gè)實(shí)心菱形,函數(shù)中的num僅為上半部分