techhipbettruvabetnorabahisbahis forumutaraftarium24edueduedueduedusedusedusedusedusedu Hollow Inverted Pyramid Star Pattern Program in C
Latest :

Hollow Inverted Pyramid Star Pattern Program in C

C Program to print a hollow inverted pyramid star pattern – In this article, we will brief in on the various methods to print a hollow inverted pyramid star pattern in C programming.

Suitable examples and sample programs have also been added so that you can understand the whole thing very clearly. The compiler has also been added with which you can execute it yourself.

The ways mentioned in this particular piece are as follows:

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

As we all know, a pyramid is a three-dimensional figure which has a square as its base and it tapers off into a point giving it the height or the third dimension.

This is what a hollow inverted pyramid looks like:

As you can see, you will have to mention the number of rows. Consequently, the pyramid will be printed accordingly taking the number of rows into consideration.

Thus, the various methods used to print a hollow inverted pyramid star pattern in C programming are as follows:

Using For Loop

  1. Read the ‘no.of rows’and read the entered character, store the values into the variables n, ch.

2) The outer for loop iterates through rows from i=n to 1 with the structure for(i=n;i>0;i–).

3) The 1st inner for loop iterates through columns with the structure for(j=1;j<=n-i;j++).

It prints space.

4) For i=1 or n

The 2nd inner for loop iterates through columns with the structure for(j=1;j<=i*2-1;j++)

Prints symbol.

5) For i!=1 or i!=n

The 3rd inner for loop iterates through columns with the structure for(j=1;j<=i*2-1;j++)

Prints symbol if j=1 or j=i*2-1.Otherwise it prints space.

6) Cursor comes to nextline for each iteration of i.

Output:

Using While Loop

  1. The while loop checks the condition first, if the condition is true then it executes the code once. If the condition is false then it terminates the loop.

2) i=n, The outer while loop iterates through rows until the condition i>0 becomes false.

3) j=1, The 1st inner while loop iterates through columns until the condition j<=n-i becomes false.

It prints space.

j value increased by 1. The 1st inner loop again checks the condition.

4) For 1st row, last row

The 2nd inner while loop iterates through columns until the condition j<=i*2-1 becomes false.

It prints symbol.j value increased by 1. The 2nd inner loop again checks the condition.

5) For other than the 1st row, last row

The 3rd inner while loop iterates through columns until the condition j<=i*2-1 is false.

It prints symbol if j=1 or j=(i*2)-1. If the condition is false then it prints space.

j value increased by 1. The 3rd inner loop again checks the condition.

6) Cursor comes to next line, i value decreased by 1. The outer while loop again checks the condition.

Output:

Using Do-While Loop

  1. The do-while loop executes the code one time then checks the condition. If the condition is true then loop iterates again.

2) i=n, The outer do-while loop iterates through rows.

3) j=1, The 1st inner do-while loop iterates through columns.

Prints space. j value increased by 1.

Checks the condition j<=n-i+1. If the condition is true then the loop iterates again. Repeats until the condition becomes false.

4) For i=1 or n

The 2nd inner do-while loop iterates through columns.

Prints symbol. j value increased by 1.

Checks the condition j<=i*2-1.If the condition is true then the loop iterates again. Repeats until the condition becomes false.

5) For i!=1 or i!=n

The 3rd inner do-while loop iterates through columns.

If j=1 or j=i*2-1 it prints symbol. Otherwise it prints space

j value increased by 1.

Checks the condition j<=i*2-1. If the condition is true then the loop iterates again. Repeats until the condition is false.

6) Cursor comes to next line.i value decreased by 1.

7) Checks the condition i>0. If the condition is true then outer loop iterates again. Repeats until the condition fails.

Output:
techhipbettruvabetnorabahisbahis forumutaraftarium24edusedueduseduseduedueduseduedusedus
x

Check Also

C Program To Find Maximum Between Three Numbers | C Programs

C Program to find maximum between three numbers –  In this article, we will detail ...

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