techhipbettruvabetnorabahisbahis forumutaraftarium24edueduseduseduedueduseduedusedusedu 8 Star Pattern - C Program | 4 Multiple Ways
Latest :

8 Star Pattern – C Program | 4 Multiple Ways

C Program to print an 8 Star Pattern – In this article, we will detail in on the various ways to print an 8-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 several ways explained in this piece are as follows:

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

As the name suggests, an 8-Star pattern is a pattern that you have to make with the help of the “*” symbol. It gives out the shape of the mathematical digit 8.

It looks like this:

8 Star Pattern - C Program

As you can see, you have to first enter the number of rows. Accordingly, your 8-Star pattern will be drawn.

THus, the ways to do the same in C programming are as follows:

Using For Loop

1) Read and store the entered number of rows and entered a symbol into the variables n, ch.

2) k is defined as k=n*2-1.

3) The outer for loop iterates through rows with the structure for(i=1;i<=k;i++)

4) If( i=1 or i=n or i=k) condition is true then

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

a) If(j=1 or j=n) is true then it prints space.

b) Otherwise, it prints symbol.

5) If (i=1 or i=n or i=k)  is false then

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

a) If( j=1 or j=n) the condition is true then it prints symbol.

b) Otherwise, it prints space.

6) Cursor comes to next line for each iteration of outer for loop.

Output:

Using While Loop

1) k=n*2-1.

2) i=1, The outer while loop with the condition i<=k iterates through rows until the condition becomes false.

3) If (i=1 or i=n or i=k ) condition is true

a) The inner while loop iterates through columns until the condition j<=n becomes false.

It prints space if( j=1 or j=n)is true. Otherwise, it prints symbol.

j value increased by 1.

4) If(i=1 or i=n or i=k)condition is false

a) The 2nd inner while loop iterates through columns until the condition j<=n becomes false.

It prints symbol if(j=1 or j=n)is true.Otherwise, it prints space.

5) The cursor comes to next line.i value increased by 1 of the outer while loop.

Output:

Using Do-While Loop

1) k=n*2-1.

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

3) If (j=1 or j=n or j=k) condition is true then

j=1, the inner do-while loop iterates through columns.

a) It prints space if j=1 or n.Otherwise, it prints symbol.

b) j value increased by 1.

Checks the condition j<=n.If the condition is true then inner loop iterates again.Repeats until the condition becomes false.

4) If(j=1 or j=n or j=k)condition is false then

j=1, the 2nd inner do-while loop iterates through columns.

a) It prints symbol if j=1 or n.Otherwise, it prints space.

b) j value increased by 1.

Checks the condition j<=n.If the condition is true then 2nd inner do-while loop iterates again until the condition becomes false.

5) The cursor comes to next line. i value increased by 1.

Checks the condition i<=k.If the condition is true then outer loop iterates again.Repeats until the condition becomes false.

Output:
techhipbettruvabetnorabahisbahis forumutaraftarium24edueduseduedueduseduseduedusedusedus
x

Check Also

C Program To Input Any Alphabet And Check Whether It Is Vowel Or Consonant

C program to input any alphabet and check whether it is vowel or consonant – ...

grandpashabetgrandpashabetgrandpashabethttps://mobilebarhawaii.com/ballettea tropazcasibom girişcasibomhacklinkgrandpashabetbets10onwinonwin girişselcuksportshdbahsegelatakoy escortatakoy escortsisli escortcratosroyalbetonwinligobetbetebetJojobethttps://www.escortbayanlariz.net/betwoonYalova escortbakırköy escortdeneme bonusu veren sitelerhalkali escortgrandpashabet girişsaankara escort bayangrandpashabet girişjojobetgrandpashabet girişonwinistanbulkart başvuruesenyurt anal escortjojobetstarzbetmaltcasinomaltcasinojojobet girişfixbetkucukcekmece escortistanbul escortsstarzbetjojobetfast creditsightcareİstanbul Escortbayraklı escortdeneme bonusu veren siteler 2025grandpashabetdeneme bonusu veren sitelerMatbetimajbetgrandpashabetgrandpashabetcasibom girişsakulisbettipobetholiganbet girişfixbetonwinhttps://sahipleniyorum.com/jojobetjojobet girişjojobet girişmatbetjojobetgrandpashabetmaltepe escortjojobetÜmraniye Escortvipslottipobetgrandpashabetistanbul kart başvurubetebetgrandpashabetjojobet girişmavibetimajbetimajbet girişimajbet güncel girişmavibet girişJojobet girişmavibetMAVİBETextrabetbetciomeybetgüncel girişbetebet girişjasminbetgüncel girişgüncel girişcasibomjojobetholiganbettipobet girişcasibom girişhttps://sahipleniyorum.com/2/kopekcasibom güncel girişcasibom güncelbets10BetsatBetsatholiganbetdeneme bonusu veren sitelerstarzbetescort avcılarPusulabetbahsegeljojobet güncel girişGrandbettinggüncel girişholiganbet twitterjojobet twitterhttps://markaescort.org/bolgeler/kartalartemisbet güncel girişescort kadıköybets10jojobetmavibetcasibom twitterholiganbet güncel girişmadridbetzbahistempobetlunabetarnavutkoy escortpusulabetfixbettempobetpusulabetgrandbettingsuperbetinimajbetcasibomsekabetbetturkeyotobetgrandpashabetfixbetbahiscomultrabetstarzbetmarsbahiscasibommadridbetbets10lunabetultrabetdinamobetbetkanyonpusulabetsahabetzbahisbahiscomnakitbahismilanobetkulisbetsahabetonwinsahabetholiganbetmarsbahismeritbetonwinbetebetonwinmarsbahissekabetbetkanyonholiganbetmatbetimajbetjojobetzbahismeritbetholiganbetmarsbahisdinamobetkralbetMatbetSahabetOnwinonwinsahabetsekabetmatbetimajbetbetturkeyMarsbahisgrandpashabetbahiscombayconti girişBetsat güncel girişHoliganbetCasibommarsbahisJojobetjojobetgrandpashabettimebetmeritkingmeritking giriştaraftariummarsbahishttps://canlicasino.shorthandstories.com/https://canlicasino.shorthandstories.com/deneme bonusujojobetmobilbahissekabet girişsekabetmeritkingjojobetYalova escortücretsiz deneme bonusubetebetultrabetbets10jojobetjojobetjojobet girişjojobetistanbul escort