techhipbettruvabetnorabahisbahis forumutaraftarium24edueduedusedueduedusedueduseduedus 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 forumutaraftarium24eduseduseduedueduseduedusedusedusedus
x

Check Also

C Program To Print Number Of Days In A Month | Java Tutoring

C program to input the month number and print the number of days in that ...

betwoonhacklink satın albets10 girişakcebet uyeliksupertotobet1xbet girişmelbet girişbetwinnerpinup uyelikbtcbahis girişmostbet girişbetwinner girişxslotskyloft uyelikmegapari uyeliktipobetgrandpashabetradissonbetmariobett.mebetandreasenbetcasivalmisbahismyhitbetonbahistipobetbahsinevavepasgolgrandpashabetmarsbahispusulabetcasibomcasibom girişcasibom güncel girişcasibomcasibom girişdeneme bonusu veren sitelerhttps://mobilebarhawaii.com/ballettea tropazjokerbet güncel girişmatadorbetbets10betturkeycasibomkingroyalcasibom girişbets10 girişcasibommaldives casinohacklinkgrandpashabetbetmatik girişmelbetmostbetmegapari üyelikistanbul escortmatadorbetimajbetJojobetcasibompinco girisonwinonwin girişcasibom güncel girişselcuksportshdcasibomjojobetatakoy escortatakoy escortsisli escortgalatabahisliste paris sportifjeux casino gratuit avec bonusSimsinos CasinojojobetCashimashi AvisWunderWinsparier sur les cornersGamdomCasibomSekabet güncel girişmadridbet girişpinbahisemiratesbettrbetcasibomcratosroyalbetpalacebetcasinokaliprensbetrestbetcasibomrestbetgrandpashabetgrandpashabetmatadorbetmaltcasinoholiganbetholiganbetmatadorbetmarsbahisonwinsahabetmostbet guncel girisbetandyou guncel girisromabet guncel giris7slots guncel girisbizbet guncel girisrocksroyalbetkazandradeneme bonusu veren sitelergrandpashabettipobetonwintempobet güncel girişprincessbethttp://nakanakadining.com/betkanyonpinup yeni girismatadorbet yeni girisroketbet yeni girisskyloft yeni girismegapari yeni girisjojobet girişsavoybettingcasinomhubligobetmavibetenobahisJojobetcoinbartempobetcoinbarmariobettarafbetcasibomkalebetjetbetbetturkeyjojobetmavibetarnavutköy escortkingroyalmaltcasinoholiganbet girişsahabetmobilbahishttps://www.escortbayanlariz.net/beylikdüzü escortfikstürbetmisliwinbetciosahabetonwinsekabetvbetholiganbetjojobetonwinmatbetmatbetimajbetimajbetsahabetJojobet Girişmariobettarafbetodeonbetbetwoonbets10sahabetbets10matadorbet güncel girişjojobet güncel girişmavibetartemisbetkingroyalcasibomcasibom girişmeritbetpinbahiszbahissekabetcasinometropolarnavutköy escortBodrum escortmarsbahis girişpinbahiscasinometropolbetebetotobetimajbetcasibomvaycasinobakırköy escortjojobetkulisbetsüperbetin güncel girişsekabetpusulabetMavibetOnwinbets10 girişmarsbahiscasibomxslot girişdeneme bonusu veren sitelermarsbahisbetturkey girişbetturkeyhalkali escortcasinomaxitarafbetcasibom girişbetwoonholiganbet güncel girişjojobetjojobet girişholiganbetmeritking güncel girişmatadorbet güncel girişmatadorbet güncel girişgrandpashabet girişsahabet girişonwin girişsekabet girişholiganbet girişjojobet girişmatbetmarsbahis güncel girişmarsbahis girişxslotjojobetpadişahbetcasibom girişcasibomjojobetselçuksportsSekabetholiganbethttps://www.gvscolombia.com/güvenilir casino siteleri antalya escortmatbetimajbet güncel girişmarsbahis güncel girişjojobetjojobet girişcasibom girişjojobetsonbahisjojobet girişankara escort bayanbetparkcasibomgrandpashabetcasibom girişmarsbahismatadorbetultrabet girişJojobetmaldives betcasibom güncel girişjojobetbetcio girişbets10grandpashabet girişbahiscasinojokerbet güncel girişSüpertotobetxslotbetpipocasibomtaraftarium24holiganbetholiganbetholiganbetjojobetimajbetbets10Sekabet güncel girişcasibomjojobetonwinextrabetmatadorbet güncel girişextrabet girişbetciobetwoonmarsbahissahabetTipobetholiganbetSekabetcasibomesenyurt anal escortrus escortartemisbetPusulabet güncel girişjojobetcasinometropolcasibom girişgüvenilir casino siteleri grandpashabetİstanbul Escortbetciohttps://www.gvscolombia.com/jojobetcasinomaxideneme bonusu veren sitelergrandpashabet girişgrandpashabetCasibomstarzbetjojobetjojobet girişbetkanyonbetkanyonJojobetsahabetjojobetjojobet girişgooglecasibomkucukcekmece escort