techhipbettruvabetnorabahisbahis forumutaraftarium24eduseduedusedueduedueduseduedusedus Hollow Inverted Right Triangle Star Pattern Java Program
Latest :

Hollow Inverted Right Triangle Star Pattern Java Program

Java program to print hollow inverted right triangle star pattern program. We have written below the print/draw hollow inverted right triangle 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 n value using scanner class method as  sc.nextInt().

2) Run the outer for loop with the structure for(int i=n;i>0;i–) to iterate through rows, to iterate through columns run the inner for loops.

3) The 1st for loop prints character if the condition if(i==1 || i==n) is true and j<=i is true, with the structure

for(int j=1;j<=i;j++).

After completion of all iterations, the following pattern will be printed.

Using For Loop:

Output:

Using While Loop

1) Checks the condition at while i>0, if true it executes the inner statements.

2) checks the if condition if(i==1 || i==n)

a) if true j initialized to 1, executes the 1st inner while loop, this loop prints character if the condition while(j <=i) is true, then increases the j value by 1, repeats until the condition is false.

b) if false j initialized to 1, while loop prints character if ( if(j==1 || j==i) true and (j<=i)) otherwise prints space, then j value increased by 1, repeats until j<=i is false.

3) Cursor comes to next line i value decreased by 1 and condition at outer while will be checked, repeats until i>0 is false at outer while loop.

Output:

Using Do While Loop

1) In outer do loop checks the if condition

a)if true 1st inner do loop will execute, j initialized to 1 and prints the character once then checks the condition at while(++j <=i), if it is true then prints the character and then checks the condition, repeats until while(++j <=i) condition is false.

b) if false, j initialized to 1, the do loop prints the character if the condition if(j==1 || j==i) is true else prints space, then checks the condition at  while(++j<=i), repeats until while(++j<=i) condition is false.

2) Cursor comes to next line, then checks the condition at outer do-while loop while(–i>0), repeat until this condition is false.

Output:

More Java Programs:

techhipbettruvabetnorabahisbahis forumutaraftarium24eduseduedusedueduedusedueduseduedus
x

Check Also

Java Program To Reverse An Array | Programs

Java program to reverse an array – We will discuss the various methods to reverse ...

grandpashabetgrandpashabetgrandpashabethttps://mobilebarhawaii.com/ballettea tropazcasibom girişcasibomhacklinkgrandpashabetbets10onwinonwin girişgrandpashabetholiganbetatakoy escortatakoy escortsisli escortjojobetCasibomtürk pornomavibet girişcratosroyalbetdeneme bonusu veren sitelergrandpashabetonwinligobetgonabetJojobetsahabethttps://www.escortbayanlariz.net/betwoonsahabetcasibomcasibom girişEskişehir escortjojobetbakırköy escortdeneme bonusu veren sitelerhalkali escortgrandpashabet girişholiganbet güncel girişankara escort bayancasino siteleriultrabetgrandpashabet girişholiganbetonwinholiganbetgrandpashabetesenyurt anal escortPadişahbetnakitbahiscasibom girişgrandpashabetİstanbul Escorthttps://www.gvscolombia.com/betebetdeneme bonusu veren sitelerJojobet GirişstarzbetsavoybettingsavoybettingjojobetfixbetBetturkey girişcasibom güncel girişkucukcekmece escortholiganbetimajbetkingroyalmadridbetmatbetmavibetmeritbetmeritkingonwinotobetmeritbetimajbetcasibomsekabetbetvolebetordercasinolevantArtemisbetmadridbetmavibetmeritking girişotobetjojobetholiganbetholiganbet girişonwincasibom girişcasibom girişsahabet girişmadridbetbetturkey girişmarsbahis giriş güncelsahabet güncel giriştipobetistanbul escortscanlı bahisstarzbetultrabetjojobetenbetvbettrromabetcasibom girişcasibomcasibom güncel girişjojobetmegabahisjojobet girişmarsbahiszbahisperabetbakırköy escortdeneme bonusu veren sitelerbetebet güncel girişdumanbetsightcarebilyoneronwinonwinsahabetbets10,bets10 giriş,bets10 güncel giriştipobetmarsbahis,marsbahis güncel giriş , marsbahis giriş,marsbahis adresmarsbahis,marsbahis güncel giriş , marsbahis giriş,marsbahis adressekabetpradabettarafbetmilanobetmilanobetpusulabettempobetpusulabettempobetpusulabetjojobetbets10madridbetBostancı escort Bağcılar escortmatbetjojobet,jojobet girişsekabet girişjojobet,jojobet girişjojobetizmir escortcasibomtipobetjasminbetİstanbul Escortbahis sitelericasibomjojobet girişJojobet Girişankara escortzbahiszbahis girişzbahis güncel girişholiganbetcasibomsonbahisdeneme bonusu veren siteler 2025vaycasinocasinomaxizbahisotobet girişimajbetcasibomvaycasinojojobetbetturkeymarsbahis girişmatbet girişmarsbahisbetturkeybetexperdeneme bonusu veren sitelermariobetwinxbetbetexperbetofficegonebetgrandpashabetgrandpashabet güncelpusulabetpusulabetcasibom girişonwin,onwin giriş,onwin güncel giriş,onwin giriş adresitipobetbetebetmarsbahisultrabetholiganbetjojobetfixbetkulisbetnakitbahispinbahisrestbettipobettrendbetultrabetjojobetholiganbetotobetbetexperpusulabetasyabahisparibahiskulisbettipobetHoliganbet girişfixbetvaycasinojojobet,jojobet girişonwinhttps://sahipleniyorum.com/jojobetjojobet girişultrabetmatbetcasibomcasibom girişmaltepe escortextrabet girişmecidiyeköy escortsekabet girişjojobettipobetbetturkeygonabettipobetcasibom girişmavibetmavibet girişmaltcasinomaltcasino girişmavibet güncelJojobet girişMAVİBETİMAJBETextrabetzbahismarsbahisbahis forumcasibom giriştakipçi hilesivaycasinocashback girişjojobetgonebetjojobetjojobetgüncel girişcasinoroyalcasibom