techhipbettruvabetnorabahisbahis forumutaraftarium24eduseduedueduedueduedueduedusedu C Program Inverted Pyramid Star Pattern | 4 Ways - C Programs
Latest :

C Program Inverted Pyramid Star Pattern | 4 Ways – C Programs

C Program to print an inverted pyramid star pattern – In this article, we will detail in on the multiple ways to print an 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 distinct piece are as follows:

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

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

This is what an inverted pyramid looks like:

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

Thus, the different methods used to print an inverted pyramid star pattern in C programming are as follows:

Using For Loop

  1. Read the entered number, the entered a character using scanf, gectchar functions and store the values into the integer variable n, character variable ch.

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

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

It prints space.

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

It prints the symbol which is entered by the user.

5) Cursor comes to the next line for each iteration of i value.

Output:

Using While Loop

  1. i=n, The outer while loop iterates through rows until the condition i>0 is false.

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

It prints space.

j value increased by 1.Again checks the condition.

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

It prints the symbol which is entered by the user.

j value increased by 1.Again checks the condition.

4) Cursor comes to next line.

5) i value decreased by 1. The outer while loop again checks the condition.

Output:

Using Do-While Loop

  1. i=n, the outer do-while loop iterates through rows.

2) j=0, the 1st inner do-while loop iterates through columns.

It prints space.j value increased by 1.

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

3) j=0, the 2nd inner do-while loop iterates through columns.

It prints symbol,j value increased by 1.

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

4) Cursor comes to next line.

5) i value decreased by 1.checks the condition i>0. If the condition is true the outer loop iterates again. Repeats until the condition becomes false.

Output:
techhipbettruvabetnorabahisbahis forumutaraftarium24eduedusedusedueduseduseduedueduedu
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 tropazmegabahis güncel girişmatadorbetbets10betturkeycasibomkingroyalbets10 girişbets10bets10maldives casinohacklinkgrandpashabetbetmatik girişmelbetmostbetmegapari üyelikistanbul escortmatadorbetjojobetJojobetjojobetpinco girisonwinonwin girişcasibom güncel girişselcuksportshdcasibomcasibomatakoy escortatakoy escortsisli escortgalatabahisliste paris sportifjeux casino gratuit avec bonusSimsinos Casinojojobet girişCashimashi AvisWunderWinsparier sur les cornersGamdomCasibommadridbet girişatlasbet.pinbahisemiratesbettrbetcasibomcratosroyalbetpalacebetcasinokaliprensbetmostbet guncel girisbetandyou guncel girisromabet guncel giris7slots guncel girisbizbet guncel girisrocksroyalbetkazandradeneme bonusu veren sitelergrandpashabetonwinprincessbethttp://nakanakadining.com/betkanyonpinup yeni girismatadorbet yeni girisroketbet yeni girisskyloft yeni girismegapari yeni girissavoybettingcasinomhubligobetmavibetenobahisJojobetpusulabetjetbetonwin girişkingroyal girişarnavutköy escortkingroyalmaltcasinoholiganbet girişsahabetjojobethttps://www.escortbayanlariz.net/beylikdüzü escortfikstürbetmisliwinmarsbahisbets10meritkingsekabet girişvbetsahabet girişholiganbetmeritkingholiganbet girişholiganbet girişjojobetjojobetbets10Jojobet Girişmariobetodeonbetodeonbetbetwoonjojobetsahabetkingroyalbets10 girişjojobetmeritking girişsekabetmeritbetcasibomcasibom girişpinbahiszbahiscasinometropolcasinomaxiarnavutköy escortGebze escort matbetzbahiscasinomaximarsbahismarsbahisbetebetcasibomperabetbakırköy escortmatbet girişbelugabahis canlı desteksüperbetin güncel girişjojobetpusulabetMavibetOnwinbets10 girişcasibomextrabetcasibomdeneme bonusu veren sitelerholiganbet girişbetturkey girişbetturkeyhalkali escortmobilbahisasyabahiscasibom güncel girişsahabetjojobetjojobetdumanbetmadridbetnakitbahisultrabetultrabetotobetkulisbetfixbetcratosslotbetturkeykralbetholiganbetmatbetcasibom girişjojobet girişpadişahbetbets10 girişbets10onwinselçuksportsSekabetholiganbethttps://www.gvscolombia.com/güvenilir casino siteleri antalya escortbetkanyonjojobetdumanbetganobetganobet girişiptviptvcashbackiptvankara escort bayaninterbahiscasibomgrandpashabetcasival girişmarsbahismatadorbetbetofficeJojobetmaldives betcasibom girişmeritkingbetciojojobet girişgrandpashabet girişbahiscasino girişmegabahis güncel girişbetorderBankobetBetordercasibom 811 giriştaraftarium24holiganbetholiganbetholiganbetjojobetzbahisGrandpashabet güncel girişcasibomjojobetonwinextrabetmatbetextrabet girişmatbet girişbetwoonmarsbahisbets10TipobetpusulabetSekabetcasibomesenyurt anal escortrus escortholiganbet girişGrandpashabetholiganbetcasinomaxicasibomgüvenilir casino siteleri grandpashabetİstanbul Escortbetciohttps://www.gvscolombia.com/marsbahisbetciodeneme bonusu veren sitelerotobetcasinomaximarsbahis girişstarzbetjojobetjojobet girişmrbahismrbahisJojobetsahabetjojobetjojobet girişgooglecasibomkucukcekmece escortsekabetsahabetrestbetpinbahisonwinmeritbetmavibetmatbetmatadorbetmaltcasinokingroyalimajbetholiganbetgrandpashabetizmir escorttexas sweepstakesflorida sweepstakessweepstakes sportsbooksweepslotsbetgaranti girişbetgarantibankobet girişPusulabet güncel girişmobilbahisbetciorestbetcasibomgrandpashabetmatadorbetmaltcasinoholiganbetmarsbahisonwinsahabetsekabetmatbetimajbetsekabet girişvaycasinotuzla escort bayancanlı bahiscasibomimajbetstarzbetmobil ödeme bozdurmajojobet