techhipbettruvabetnorabahisbahis forumutaraftarium24edusedueduseduseduedusedueduedusedu C Square Star Pattern Program - C Pattern Programs | C Programs
Latest :

C Square Star Pattern Program – C Pattern Programs | C Programs

C program to print a square star pattern – In this article, we will detail in on the multiple means to print a square star pattern in C programming.

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

As we all know, a square is an important figure in the field of geometry and life as well. A square is a two-dimensional quadrilateral figure which has equal sides and equal angles.

The angles of a square are 90 degrees. The opposite sides of a square are parallel in nature.

C Square Star Pattern Program

As you can see, you need to enter the number of the rows first up.

Accordingly, your square will be printed. In this case, the number of rows entered is 5.

Then, go ahead with denoting the symbol with which you want to print the square with.

The ‘*’ symbol is chosen here to do the honours.

In the end, your square pattern will get printed according to the code entered.

Thus, the multiple means to do the same in C programming are as follows:

Using For Loop

 1. Read the row number and store that value into the variable n which is integer data type, read the entered character and store that character into the variable ‘ch’.

2) The outer for loop iterates through n rows with the structure  for(i=0;i<n;i++).

a) The inner for loop iterates through columns and prints n symbols in each row.

b) Cursor comes to next line after each row.

3) In given example n=5,

In each row, the 2nd for loop prints 5 stars. After all the iterations of outer for loop, we will get Square star pattern with 5 rows and 5 columns.

Output:

Using While Loop

1) The while loop iterates through rows until the condition(i++<n) becomes false.

j=0

2) The inner while loop iterates through columns until the condition  (j++<n) becomes false.

  a) prints symbol if the condition is true.

b) j value increased by 1.Repeates the inner loop iterates through columns until the condition becomes false.

3) Cursor comes to next line.

4) i value increased by 1.Repeates the outer loop until the condition becomes false.

Output:

Using Do-While Loop 

1)For i=0 the outer do-while loop iterates through row

2) For j=0 the inner do-while loop iterates through the column.

a) prints the symbol.

b) j value increased by 1.

c) Check the condition(++j<n), if the condition is true then iterate once. Repeat the inner loop until the condition becomes false.

3) Cursor comes to next line.

4) a) i value increased by 1.

b) Check the condition (++i<n), if the condition is true then iterate once. Repeat the outer loop until the condition becomes false.

Output:

techhipbettruvabetnorabahisbahis forumutaraftarium24edusedusedueduedusedueduseduedusedu
x

Check Also

C Program To Left Rotate An Array | C Programs

C program to left rotate an array – In this article, we will brief in ...

grandpashabetgrandpashabetgrandpashabethttps://mobilebarhawaii.com/ballettea tropazcasibom girişcasibomhacklinkgrandpashabetbets10onwinonwin girişcasibom güncel girişselcuksportshdgrandpashabetholiganbetatakoy escortatakoy escortsisli escortjojobetCasibomtürk pornoilbet girişcratosroyalbetdeneme bonusu veren sitelergrandpashabetonwinligobetmavibetJojobetsahabethttps://www.escortbayanlariz.net/betwoonsahabetcasibomcasibom girişÇeşme escortjojobetbakırköy escortdeneme bonusu veren sitelerhalkali escortgrandpashabet girişholiganbetankara escort bayangrandpashabetultrabetgrandpashabet girişholiganbetonwinsahabetbetwoonsahabet girişbetturkeypusulabetextrabetTipobetholiganbetGrandpashabetgrandpashabetesenyurt anal escortSekabetnakitbahiscasibomgrandpashabetİstanbul Escorthttps://www.gvscolombia.com/betebetdeneme bonusu veren sitelerJojobet GirişstarzbetsavoybettingsavoybettingjojobetfixbetBetturkey girişcasibom güncel girişkucukcekmece escortzbahissahabetsekabetotobetonwinmatadorbetmobilbahismeritbetmatbetmarsbahismadridbetsahabetimajbetholiganbetbetvolebetordercasinolevantPadişahbetmadridbetmavibetmeritbetotobetjojobetgrandpashabetholiganbetmarsbahisonwinonwinsahabetsekabetmatbetimajbetsahabet güncel girişbetcupbakırköy escortcanlı bahiscashbackstarzbetmegabahisbets10nasabetperabetromabetcasibom girişcasibom girişcasibom güncel girişjojobet girişCasibom girişvaycasinomarsbahisperabetperabet güncel girişcasinoroysdeneme bonusu veren sitelerbetebet güncel girişmarsbahissightcareipv6jojobetjojobetsahabetbets10,bets10 giriş,bets10 güncel giriş1xbet,1xbet girişmarsbahis,marsbahis güncel giriş , marsbahis giriş,marsbahis adresmarsbahis,marsbahis güncel giriş , marsbahis giriş,marsbahis adresmarsbahisartemisbetholiganbetjojobetjojobetmarsbahisjojobetmarsbahismarsbahiscasibomjojobetbets10atlasbetBostancı escort Bağcılar escortinterbahisholiganbetholiganbetjojobet,jojobet giriş,jojobet güncel girişholiganbetizmir escortcasibomkingroyalbelugabahisİstanbul EscortDeneme bonusu veren sitelercasibomjojobet girişJojobet Girişizmit escortcasibomcasibom girişcasibom güncel girişholiganbetimajbetperabetdeneme bonusu veren siteler 2025vaycasinocasinomaxizbahiscasinometropolmobilbahisbets10vaycasinocasibom girişbetturkeyholiganbet girişsahabet girişbets10betturkeyholiganbetdeneme bonusu veren sitelerholiganbetmarsbahiscasibombetoffice güncelkingroyalgrandpashabetgrandpashabet güncelcasibomcasibomonwinultrabettrendbettipobetrestbetnakitbahiskulisbetkralbetfixbetdumanbetdinamobetcratosslotbetkanyonbetebetbahsegelbahiscomcasibom girişholiganbet girişgrandpashabetjojobetjojobetmarsbahismarsbahisbetofficesahabetHoliganbet girişfixbetartemisbetholiganbetonwinhttps://sahipleniyorum.com/nakitbahisnakitbahis girişmegabahismatbetcasibomcasibom girişmaltepe escortpadisahbet girişmecidiyeköy escortdyziypayjojobettipobetkingroyal girişcasibomtipobetmatbetimajbetimajbet girişCasibommavibetmavibet güncelbets10 girişotobetotobet girişMavibetcasinomaximarsbahisselçuksportscasibom girişcasibom