Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)
Java Hollow Inverted Pyramid Star Pattern Program
Latest :

Java Hollow Inverted Pyramid Star Pattern Program

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

  • Using For Loop
  • Using While Loop
  • Using Do While Loop

Using For Loop

1) Read the entered value and store in the variable n.

2) Run the outer loop with the structure for(int i=n;i>0;i–) for n times.

3) Run the 1st inner loop with the structure for(int j=1;j<=n-i;j++)

prints space for i>0 and j<=n-i

4) If the first inner loop condition is false then checks the” if” condition

– condition true 1st loop prints character for ( i==1 or i==n) and j<=i*2-1,

-condition false 2nd  loop prints character for (j==1 || j==i*2-1), prints space for (j!=1&j!=i*2-1) until j<=i*2-1

Output:

Using While Loop

1) The outer while will iterate n times,if the condition is true at outer loop then inner while loop condition true then prints space. condition false check the condition at “if”.

2)

a)If condition true first while loop prints character until j++<=i*2-1 is false.

b) condition false next while loop prints character for j==1 , j==(i*2)-1), until while(j<=(i*2)-1) condition is false.

c) prints space for j!=1 and J!=(i*2)-1, until  while(j<=(i*2)-1) condition is false.

Output:

Using Do-While Loop

1) Outer do-while loop iterates until i>0 condition if false.

2) The inner loop prints space, after that it checks the condition, it prints space until the condition (++j <=n-i+1); is false.

3) “if” condition true 1st do-while loop prints character until the condition (++j <=i*2-1) is false.

4) “if” condition false 2nd do-while loop prints character if  (j==1 || j==i*2-1) is false, until the condition (++j <=i*2-1) is false.

Output:

For More Star Pattern Java Programs Visit Here

x

Check Also

Java Program Count Vowels In A String | Programs

Java Program to count vowels in a string – Here, we discuss the various methods ...

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 escortgrandpashabetgrandpashabetgrandpashabetgrandpashabetbetgaranticasibomjojobetcasibom 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 sitelerHititbetjojobetDeneme Bonusu Veren Sitelerfivem modscasibompadişahbetjojobetjcknepadişahbetBetsatVdcasinokalebetsekabetHoliganbetzbahiszbahisotobetotobetkingroyalkingroyalmadridbetmadridbetmarsbahis giriş토토사이트atlasbetmarsbahisnumber one model agencyportobettimebettimebetdizipalHititbet Girişpusulabet betparkbetparkcasibomcasibomcasibomkalebetbetpuancasibom girişzbahiscasibommatbet güncel girişjojobet girişpusulabet girişpusulabet girişgrandpashabet girişmeritking girişgrandpashabet girişmarsbahis giriş güncelgrandpashabet güncel girişonwinsahabetmatadorbetjojobetholiganbetonwinonwin girişsahabet girişmatadorbet giriştipobetmeritkingonwin girişjojobetmeritkingonwinonwinonwinpusulabet pusulabetcasibomcasibom girişcasibom güncel girişcasibom güncelrestbet girişmarsbahiscoinbardinamobetmatbettipobetmeritkingbetpuansahabet güncel girişonwinholiganbetsahabetonwinkralbet girişkralbetcoinbarcoinbar girişcoinbar girişdinamobet girişsahabetbets10bets10 girişdinamobetmeritkingsahabet güncel girişdinamobetmatbetdinamobet girişsuperbetinsahabetmatbet giriştipobet giriştipobet girişmeritking girişsahabet güncel girişmeritkingHoliganbetbetpuanmarsbahis girişbahiscombetpuancasinoper güncel girişcasibomholiganbetcasinoper girişcasinoperPusulabetcasibom girişmarsbahisromabettambetdinamobetcoinbarbetwooncasibombetofficejojobetgrandpashabetgrandpashabetgrandpashabetlunabetgrandpashabetmarsbahis