Shortest and Smart code for diamond pattern in just 2 FOR loops.. #include #include #include void main() { int n,row,col,flag=0; printf("Enter Number"); scanf("%d",&n); for(row=1; row>=1; row++) { for(col=1; col=row) printf("*"); else printf(" "); } printf(" "); if(row==n) flag=1; if(flag==1) row = row-2; } }
@wethecomputerguys990310 жыл бұрын
@V Lak Here is the link to the diamond pattern. wethecomputerguys.com/2014/09/08/pattern-printing-28/
@SmartProgramming6 жыл бұрын
awesome work sir, keep going, best wishes for future 👍👍
@nikhilgoyal83409 жыл бұрын
Here for printing spaces in the second case we can use the same for loop as used above that is ::: for(colSpace = totalRows-row ; colSpace >=1 ; colSpace--) In the second for loop since we have started counting rows from 4 the same logic for printing spaces will work.
@yuvrajadkar2 жыл бұрын
Shortest and Smart code for diamond pattern in just 2 FOR loops.. #include #include #include void main() { int n,row,col,flag=0; printf("Enter Number"); scanf("%d",&n); for(row=1; row>=1; row++) { for(col=1; col=row) printf("*"); else printf(" "); } printf(" "); if(row==n) flag=1; if(flag==1) row = row-2; } }
@SaumyaSharma0075 жыл бұрын
Thanks man 👍 for the concept....
@arilee545010 жыл бұрын
Thank you so much for your detailed explanation. it was extremly helpful!
@ItTimetotravel4 жыл бұрын
kzbin.info/www/bejne/moisloemh5eBrdU for reverse pattern for beginner
@yuvrajadkar2 жыл бұрын
Shortest and Smart code for diamond pattern in just 2 FOR loops.. #include #include #include void main() { int n,row,col,flag=0; printf("Enter Number"); scanf("%d",&n); for(row=1; row>=1; row++) { for(col=1; col=row) printf("*"); else printf(" "); } printf(" "); if(row==n) flag=1; if(flag==1) row = row-2; } }
@DannyKnot9 жыл бұрын
What if instead of using white spaces I wanted to use "+" ?
@deepaagrawal865310 жыл бұрын
thanks for making me to take intrest in learning in pattern only becoz of ur awesome video
@deepaksuri84237 жыл бұрын
I looking for help with the pattern of : Seven lines of output as follows: The first consists of 3 spaces followed by a star. The second line consists of 2 spaces followed by a 3 stars. The third consists of one space followed by 5 stars, and the fourth consists just of 7 stars. The fifth line is identical to third, th sixth to the second and the seventh to the first.
@yuvrajadkar2 жыл бұрын
Shortest and Smart code for diamond pattern in just 2 FOR loops.. #include #include #include void main() { int n,row,col,flag=0; printf("Enter Number"); scanf("%d",&n); for(row=1; row>=1; row++) { for(col=1; col=row) printf("*"); else printf(" "); } printf(" "); if(row==n) flag=1; if(flag==1) row = row-2; } }
@abhitasan9 жыл бұрын
Can you provide me a code whose pattern resembles to a diamond and in between that i have to write AMU ,means in the middle line ..
@serajhassan5457 жыл бұрын
can u write code only using 3 loops that will print at a time instead of writing two times for each parts because its not look good.
@cafafans5 жыл бұрын
I saw so many comments complaining; I decided to help you guys; for anyone that care, here is a link to my Github Repo. You can download all source codes. If you have any question; feel free to ask. github.com/ElectronicMoney/PatternPrinterCProgramming
@yuvrajadkar2 жыл бұрын
Shortest and Smart code for diamond pattern in just 2 FOR loops.. #include #include #include void main() { int n,row,col,flag=0; printf("Enter Number"); scanf("%d",&n); for(row=1; row>=1; row++) { for(col=1; col=row) printf("*"); else printf(" "); } printf(" "); if(row==n) flag=1; if(flag==1) row = row-2; } }
@justarandompersonontheinte98184 жыл бұрын
Does this code uses recursion?
@MS-rl7rh3 жыл бұрын
Thank you sir, it's very helpful
@bipros79 жыл бұрын
Sir,after coding the above statements when i run this program,stars of upper half of the triangle from row 1 to row 5....but the lower half of the triangle is not executed...I'm using turbo C++ compiler fr windows7...why is this happening?
@vijayKumar-pf8ol8 жыл бұрын
beta ye work ni kregaa
@Kris-ui1wv6 жыл бұрын
#include int main() { int n, m, k, i= 1; printf("Vendosni numrat e rreshtave ");//n-nr rreshtash scanf("%d", &n); i = n - 1;//i hapesira for (k = 1; k
@vignesh85075 жыл бұрын
@@Kris-ui1wv appreciate you
@yuvrajadkar2 жыл бұрын
Shortest and Smart code for diamond pattern in just 2 FOR loops.. #include #include #include void main() { int n,row,col,flag=0; printf("Enter Number"); scanf("%d",&n); for(row=1; row>=1; row++) { for(col=1; col=row) printf("*"); else printf(" "); } printf(" "); if(row==n) flag=1; if(flag==1) row = row-2; } }
@esomcmuffin898910 жыл бұрын
Would you be able to write this code, except take in user input for the middle row and have a minimum of 2 stars in each row? Im having a lot of trouble in doing so. Thanks
@wethecomputerguys990310 жыл бұрын
Eso McMuffin I dint get your doubt. can u send me a sample input / output for your question?
@esomcmuffin898910 жыл бұрын
So I would like the program to accept user input for the middle row and how many rows on top and below the middle as well. so if user enter 6 for middle row and 4 on top: ** **** ****** **** ** also, there cannot be less than 2 asterisks per row
@muhammadsheharyar41057 жыл бұрын
you are awsome bro ......realy a helpfull video for my assgnment..keep it up
@yuvrajadkar2 жыл бұрын
Shortest and Smart code for diamond pattern in just 2 FOR loops.. #include #include #include void main() { int n,row,col,flag=0; printf("Enter Number"); scanf("%d",&n); for(row=1; row>=1; row++) { for(col=1; col=row) printf("*"); else printf(" "); } printf(" "); if(row==n) flag=1; if(flag==1) row = row-2; } }
@sunilsharma96119 жыл бұрын
Very very thanks for helping .
@muwangasulaiman92466 жыл бұрын
hey write for me a program which prints 6 stars in the first column,4 in the second,3 in the third,2 in the forth.remember there are 8 columns and 6 rows.but the forth row is printed throughout.am waiting thanks
@speakingwordsindia56318 жыл бұрын
not a correct code i think. The program is not running correctly plz help
@olsonjames26144 жыл бұрын
how to get the out of 9 stars shape by using c++ program
@shristisinha72645 жыл бұрын
how we will write the code for N pattern
@lakhdeepsingh58837 жыл бұрын
sir pls tell, which platform you use to write codes, i use turbo c
@YashYadav-dd7is7 жыл бұрын
Lakhdeep singh It is dev-c
@seeknithyashri65917 жыл бұрын
sir why u r naming the lower half as 4 3 2 1...can we name it as 1 2 3 4....
@baljotsingh40134 жыл бұрын
Because the loop is working in reverse, so the rows will be 4 3 2 1, 1 2 3 4 is when you're iterating a normal loop
@skylar62689 жыл бұрын
Sir , in the first nested loop to print * - last video u told the logic is.. for(colstar=1;colstar
@skylar62689 жыл бұрын
i got it :P tq !
@yuvrajadkar2 жыл бұрын
Shortest and Smart code for diamond pattern in just 2 FOR loops.. #include #include #include void main() { int n,row,col,flag=0; printf("Enter Number"); scanf("%d",&n); for(row=1; row>=1; row++) { for(col=1; col=row) printf("*"); else printf(" "); } printf(" "); if(row==n) flag=1; if(flag==1) row = row-2; } }
@khanzadaasad41279 жыл бұрын
how to make program for this output?? * * * * * * * * * * * *
@Junaidkhan-ti8qd9 жыл бұрын
+khanzada Asad hahahahahaha hpala e jora wa kana
@tryingtocorrect8 жыл бұрын
+khanzada Asad This is just a quick one, surely can be done in a better way, but it works (size is the size of the figure): #include using namespace std; int main() { int size = 4; int halfHeight = 2 * size; for (int i = 0; i < halfHeight; ++i) { for (int j = 0; j < halfHeight - i; ++j) cout
@krishnadevanp38206 жыл бұрын
Which compiler is this??...can you help.Me to install that on windows10
@satarabanolur92846 жыл бұрын
Krishnadevan P devC++ dude
@martialolipiano98034 жыл бұрын
please can you do it in Visual Logic?
@thespicyspicey4 жыл бұрын
Check out this video, you'll understand kzbin.info/www/bejne/lYmxhJpsdt9mgKc
@bonifacemusembi94599 жыл бұрын
how can i form this pattern * * * * * * * * * * * please help
@ThePheonix1238 жыл бұрын
The code source link is not working for me, can u pls post a working link?
@Ghandimw28 жыл бұрын
+ThePheonix123 This is the same code but uses an input from the user in order to make the triangle. Use the online c++ compiler c++ shell and it'll run. #include using namespace std; int main() { int n; cout > n; for (int row=1; row=1; col--){ cout
@yuvrajadkar2 жыл бұрын
Shortest and Smart code for diamond pattern in just 2 FOR loops.. #include #include #include void main() { int n,row,col,flag=0; printf("Enter Number"); scanf("%d",&n); for(row=1; row>=1; row++) { for(col=1; col=row) printf("*"); else printf(" "); } printf(" "); if(row==n) flag=1; if(flag==1) row = row-2; } }
@zekosalemeh41357 жыл бұрын
hey i saw all the video you install and i liked i want to know what to do if my dev c++ make cmd run then close without show me the solution
@ashishmane13439 жыл бұрын
"9 7 C:\Users\Ashish\Desktop\porgrams\pattern print 2.cpp [Error] 'colstar' was not declared in this scope" what does that mean pleas tell me the solution on this error........
@wethecomputerguys99039 жыл бұрын
Ashish Mane Post your source code.
@ashishmane13439 жыл бұрын
#include main(){ int totalrows=5; int row,colspace,rowstar; for(row=1;row=1;colspace--){ printf(" "); } for(colstar=1;colstar=1;row--){ for(colspace=1;colspace
@bipros79 жыл бұрын
Ashish Mane while declaring you mentioned rowstar instead of colstar,thatswhy this error is coming...
@Junaidkhan-ti8qd9 жыл бұрын
+Biprodip Sanyashi how this error can be removed plz tell me as they say "undefine colstar"in the upper written program
@skylar62689 жыл бұрын
+Junaid khan error can be removed by changing the name of the variable rowstar into colstar (or) instead of colstar use rowstar itself !
@lynetsvotwa37049 жыл бұрын
please make the programs simple and i need a program to accept m*n matrix and generate a (m+1)(n+1)
@justinkujur46184 жыл бұрын
How can i solve this program using a single loop
@yuvrajadkar2 жыл бұрын
Shortest and Smart code for diamond pattern in just 2 FOR loops.. #include #include #include void main() { int n,row,col,flag=0; printf("Enter Number"); scanf("%d",&n); for(row=1; row>=1; row++) { for(col=1; col=row) printf("*"); else printf(" "); } printf(" "); if(row==n) flag=1; if(flag==1) row = row-2; } }
@Pachojuanck6 жыл бұрын
Ojala hubiera gente que explicara como tu, pero en español :/
@malkeetsingh88499 жыл бұрын
Marvellous guys.
@shitizgupta35579 жыл бұрын
can you plz tell me how to print this &&&&&&& &&&&& &&& &
@Elporqué-m6w7 жыл бұрын
I need to make 64 combinations wiht + and - heelp me please in this
@IbnHussain129 жыл бұрын
Great work ..
@dilhanidesilva5489 жыл бұрын
thank you sir
@aiazasheikh82245 жыл бұрын
Kindly provide this using do while loop
@shaleen94347 жыл бұрын
sir please make a video on i in Ind Indi india
@SUNNYPATILkolhapurkar6 жыл бұрын
char word[ ]={'i','n','d','i','a'}; for(int i=0;i
@pratyushsrivastava44766 жыл бұрын
Printf(" - %5.*",(arrayname), (width)) ; ... Look for it in you book
@zareensayed69224 жыл бұрын
Thanks 😊
@profstat19709 жыл бұрын
guys pls tell me how to find this output without using any spaces * ** * ** *
@tryingtocorrect8 жыл бұрын
+Prof Stat hmm, how can that be done without spaces becouse it clearly ahs spaces..
@jasluvdeepsingh84918 жыл бұрын
The number of * printed is same as the row we are in. Row 1 has 1 * and 2 has 2 *. No need for spaces. Just write the loop for star with for(row=1; row
@zoufisha63768 жыл бұрын
awesome and fully usefull
@benjidabull6 жыл бұрын
THANK YOU SO MUCH
@munazamalik74276 жыл бұрын
Isi ko C++ me kese bnaty hn plz tell me 😑
@priyachaudhary12106 жыл бұрын
If(j>=5-i&&j
@apsietese87183 жыл бұрын
Thank you
@suprajaprabakaran21597 жыл бұрын
I need a mentor to write a c programming... I wanna know about the c programming from beginning... can u please guide me...can u give me ur email Id pls...
@shreyapaul3585 жыл бұрын
With my like u complete 1k like🙂
@nagapurisaivishal16677 жыл бұрын
Please i need Code make video for below pattern 1 1 33 33 555555 33 33 1 1
@Abdu_4016 жыл бұрын
Thanks
@mohammedk.k64727 жыл бұрын
thanks Sir
@Usgshshs9 жыл бұрын
kardeşim teşekkür ederim
@jhay-araguilar546210 жыл бұрын
if n = 4 4 3 2 1 3 2 1 2 1 1 Can you help me please?
@wethecomputerguys990310 жыл бұрын
Hope this would be helpful : wethecomputerguys.com/2014/08/23/pattern-printing-23/
@jhay-araguilar546210 жыл бұрын
//print spaces for(j=0;j0;j-) printf(“%d “,j); This part is incorrect and I try to rearrange this but it's still no good.
@wethecomputerguys990310 жыл бұрын
Jhay-ar Aguilar We are extremely sorry for our mistake ... Thanx for pointing it out.. I have updated the code .. Now it works fine..