Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)
Java Mirrored Half Diamond Star Pattern Programs | Patterns
Latest :

Java Mirrored Half Diamond Star Pattern Programs | Patterns

Java program to print mirrored half diamond star pattern program. We have written below the print/draw mirrored half diamond asterisk/star pattern program in four different ways with sample example and output, check it out. At the end of the program, we added compiler so that you can execute the below codes.

  • Print Mirrored Half Diamond Star Pattern – Using For Loop
  • Print – Using While Loop
  • print – Using Do While Loop

Using For Loop

1) For loop, execute the group of statements n number of times.

2) The 1st outer for loop iterates until the condition i<=n is false, the first inner loop display space until the condition j<=n-i is false,

3) 2nd inner loop will display the character until the condition j<i is false. The 1st outer loop will display this pattern after all iterations.

4) The 2nd outer loop iterates until the condition i>0 is false, the first inner loop will display space until j<=n-i is false. The 2nd inner loop will display character until the condition j<=i is false. The 2nd outer loop will display this pattern.

Output:

Using While Loop

1) 1st outer while loop will execute the code until the condition i<=n is false. The 1st inner loop will display the space until the condition j++<=n-i  is false, the 2nd inner loop will display the character until the condition j++<=i is false. The 1st outer loop will display the first half of the pattern of mirrored half diamond star pattern.

After first outer loop execution, the cursor comes to next line and executes the 2nd outer while loop.

2) 2nd outer loop will execute the statements until the condition i>0 is false, the 1st inner loop displays the space until the condition j++<=n-i is false, the 2nd inner loop will display character until the condition j++<=i is false. The 2nd outer loop will display the remaining half of the pattern of a mirrored half diamond.

Output:

Using Do-While Loop

1) The do-while loop executes the code one time then checks the condition at while.

2) The 1st outer do-while loop executes the code until the condition is false ++i<=n is false, 1st inner loop will display the space until the condition ++j<=n-i+1 is false, 2nd inner loop will display character until the condition ++j<=i is false. This outer loop displays half of the pattern of a mirrored half diamond pattern.

3) The 2nd outer do-while loop executes the code until the condition–i>0 is false, 1st inner loop will display space until the condition ++j<=n-i+1, 2nd inner loop will display character until the condition ++j<=i is false. This outer loop displays the remaining half of the pattern of a mirrored half diamond pattern.

Output:

More Java Programs:

x

Check Also

Java Program Convert Fahrenheit To Celsius | Vice Versa

Java Program to convert Fahrenheit to Celsius – Here we discuss the various methods to ...

atakoy escortatakoy escortbakırköy escortşişli escortbağcılar escortsightcaredeneme bonusu veren sitelerromabetdeneme bonusu veren sitelerdeneme bonusu veren sitelerDeneme Bonusu Veren SitelerDeneme Bonusu Veren SitelerDeneme Bonusu Veren SitelerDeneme Bonusu Veren Siteleren güvenilir bahis sitelerideneme bonusu veren sitelergrandpashabetgrandpashabetGrandpashabetdeneme bonusu veren sitelerdeneme bonusu veren sitelergrandpashabetcasibom güncel girişdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelercasinofastbetwoonroyalbetdeneme bonusugrandpashabetdeneme bonusu veren sitelermarsbahis girişvaycasino girişmeritkingdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelerdeneme bonusu veren sitelerromabetistanbul escortgrandpashabetgrandpashabetgrandpashabetgrandpashabetelitcasinocasibomjojobetcasibom güncel girişcasibom güncelcasibom güncelcasibom güncel girişsetrabetgrandpashabet girişgrandpashabetgrandpashabet girişcasibomcasibom güncel girişcasibomcasibom girişcasibom güncel girişcasibomcasibom girişcasibom güncel girişgrandpashabetgrandpashabet girişgrandpashabetgrandpashabet girişbetgray güncel girişvdcasinograndpashabetgrandpashabetgrandpashabetgrandpashabetgrandpashabetMeritkingzbahiscasibom girişcasibom girişcasibom girişdeneme bonusubetcio girişbetkomdeneme bonusu veren sitelerRokubetjojobetDeneme Bonusu Veren SitelerjojobetcasibompadişahbetjojobetjcknepadişahbetBetsatVdcasinokalebetsekabetHoliganbetzbahiszbahisotobetnakitbahiskingroyalkingroyalmadridbetmadridbetmarsbahis giriş토토사이트atlasbetmarsbahisLefkoşa İngilizce KursuportobettimebettimebetdizipalRokubet girişpusulabetbetparkbetparkcasibomcasibomcasibomkalebetbetpuancasibom girişzbahiscasibommatbet güncel girişvdcasino girişbahiscompusulabet girişgrandpashabet girişmeritking girişgrandpashabet girişmeritking girişbahiscom girişonwinsahabetmatadorbetjojobetholiganbetonwinvbetsahabet girişmatadorbet girişextrabet girişmegabahis girişvbetjojobetmeritkingonwinonwinonwinpusulabetpusulabetcasibomcasibom girişcasibom güncel girişcasibom güncelrestbet girişmarsbahiscoinbarvbetmatbetextrabetmegabahisbetpuansahabet güncel girişonwinholiganbetmarsbahisonwinkralbet girişkralbetmarsbahis girişcoinbar girişcoinbar girişdinamobet girişsahabetbets10bets10 girişdinamobetmeritkingsahabet güncel girişdinamobetmatbetdinamobet girişolabahissahabetmatbet giriştipobet girişvbetperabetsahabet güncel girişextrabet güncel girişHoliganbetbetpuanmegabahis güncel girişbahiscombetpuangrandpashabet girişcasibomholiganbetcasinoper girişcasinoperPusulabetcasibom girişdedebetromabettambetdinamobetmarsbahis girişbetwooncasibombetofficejojobetgrandpashabetgrandpashabetgrandpashabetlunabetgrandpashabetmarsbahis