techhipbettruvabetnorabahisbahis forumutaraftarium24eduedueduedueduedusedusedueduedus X Star Pattern C Program 3 Simple Ways | C Star Patterns
Latest :

X Star Pattern C Program 3 Simple Ways | C Star Patterns

C Program to print the X star pattern – In this article, we will learn the multiple methods of how to print the X 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 methods discussed in this piece are as follows:

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

An X star pattern is a pattern that you have to print using the “*” symbol in the form of an X. This is what it looks like:

X Star Pattern C Program

In this case, the value of “n” has been set to 5. So, each arm of the X star pattern will have 5 “*” symbols.

Thus, the various methods used to print the X star pattern 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) The inner for loop iterates through columns with the structure for(j=1;j<=k;j++).

a) if j=i or j=k-i+1 condition is true then this loop prints symbol.

b) If the condition is false then this loop prints space.

5) 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) j=1, The inner while loop iterates through columns until the condition j<=k becomes false.

a) Prints symbol if j=i or j=k-i+1 the condition is true. Otherwise, it prints space.

b) j value increased by 1.

4)  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) j=1, The inner do-while loop iterates through columns.

a) if j=i or j=k-i+1 the condition is true then loop prints symbol.

b) otherwise, it prints space.

c) j value increased by 1.

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

4) The cursor comes to next line.

5) 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 forumutaraftarium24edueduseduseduedusedusedueduseduedu
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 escortmatadorbetjojobetJojobetcasibompinco 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 escortFethiye escortmarsbahis girişpinbahiscasinometropolbetebetotobetimajbetcasibombetsatbakı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şholiganbetcasinometropolcasibom girişgüvenilir casino siteleri grandpashabetİstanbul Escortbetciohttps://www.gvscolombia.com/jojobetcasinomaxideneme bonusu veren sitelergrandpashabet girişgrandpashabetCasibomstarzbetjojobetjojobet girişbetkanyonbetkanyonJojobetsahabetjojobetjojobet girişgooglecasibomkucukcekmece escortartemisbet