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.
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.
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
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
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
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
+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
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?
+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
"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........
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
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...
dude you're a life saver !!!
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;
}
}
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.
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;
}
}
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.
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;
}
}
awesome work sir, keep going, best wishes for future 👍👍
Thank you sir, it's very helpful
Thanks man 👍 for the concept....
Thank you so much for your detailed explanation. it was extremly helpful!
th-cam.com/video/dWIeTpR2Nws/w-d-xo.html for reverse pattern for beginner
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;
}
}
Very very thanks for helping .
thanks for making me to take intrest in learning in pattern only becoz of ur awesome video
Does this code uses recursion?
@V Lak Here is the link to the diamond pattern. wethecomputerguys.com/2014/09/08/pattern-printing-28/
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
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;
}
}
Marvellous guys.
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.
Thank you
please make the programs simple and i need a program to accept m*n matrix and generate a (m+1)(n+1)
What if instead of using white spaces I wanted to use "+" ?
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 ..
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
Eso McMuffin I dint get your doubt. can u send me a sample input / output for your question?
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
Sir , in the first nested loop to print * - last video u told the logic is.. for(colstar=1;colstar
i got it :P tq !
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;
}
}
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
Thanks 😊
you are awsome bro ......realy a helpfull video for my assgnment..keep it up
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;
}
}
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
how to make program for this output??
*
* *
* *
* *
* *
* *
*
+khanzada Asad hahahahahaha hpala e jora wa kana
+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
how can i form this pattern
*
* *
* * * * *
*
*
*
please help
not a correct code i think. The program is not running correctly
plz help
please can you do it in Visual Logic?
Check out this video, you'll understand
th-cam.com/video/_XNSg6Az3JE/w-d-xo.html
how to get the out of 9 stars shape by using c++ program
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?
beta ye work ni kregaa
#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
@@Kris-ui1wv appreciate you
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;
}
}
how we will write the code for N pattern
sir pls tell, which platform you use to write codes,
i use turbo c
Lakhdeep singh It is dev-c
thank
you
sir
Which compiler is this??...can you help.Me to install that on windows10
Krishnadevan P devC++ dude
The code source link is not working for me, can u pls post a working link?
+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
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;
}
}
sir why u r naming the lower half as 4 3 2 1...can we name it as 1 2 3 4....
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
awesome and fully usefull
It is awesome
THANK YOU SO MUCH
"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........
Ashish Mane Post your source code.
#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
Ashish Mane while declaring you mentioned rowstar instead of colstar,thatswhy this error is coming...
+Biprodip Sanyashi how this error can be removed plz tell me
as they say "undefine colstar"in the upper written program
+Junaid khan error can be removed by changing the name of the variable rowstar into colstar (or) instead of colstar use rowstar itself !
Ojala hubiera gente que explicara como tu, pero en español :/
Great work ..
If(j>=5-i&&j
How can i solve this program using a single loop
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;
}
}
can you plz tell me how to print this
&&&&&&&
&&&&&
&&&
&
Kindly provide this
using do while loop
sir please make a video on
i
in
Ind
Indi
india
char word[ ]={'i','n','d','i','a'};
for(int i=0;i
Printf(" - %5.*",(arrayname), (width)) ; ... Look for it in you book
Thanks
I need to make 64 combinations wiht + and - heelp me please in this
THANKSSSSSSSSSS SIRRRRRRRRRR
guys pls tell me how to find this output without using any spaces
*
**
*
**
*
+Prof Stat hmm, how can that be done without spaces becouse it clearly ahs spaces..
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
kardeşim teşekkür ederim
thanks Sir
thank u sir
Isi ko C++ me kese bnaty hn plz tell me 😑
Please i need Code make video for below pattern
1 1
33 33
555555
33 33
1 1
Nyc...
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...
if n = 4
4 3 2 1
3 2 1
2 1
1
Can you help me please?
Hope this would be helpful : wethecomputerguys.com/2014/08/23/pattern-printing-23/
//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.
Jhay-ar Aguilar We are extremely sorry for our mistake ... Thanx for pointing it out.. I have updated the code .. Now it works fine..
We The Computer Guys It works. Thanks. :)
good idea... sad that his accent is too strong... i can not understand, what he says.
if n = 4
4 3 2 1
4 3 2
4 3
4
need help :(
If n=4
for(i=1;i=i;j--)
{
cout
lan bu ne biçim ingilizce 12 dakika 43 saniye boyunca işkence ettin be bilader.
thanks for video, great india namaste
Sir please explain the below pattern
1
1 * 2
1 * 2 * 3
1 * 2 * 3 * 4
1 * 2 * 3 * 4 * 5
bro print this pattern.
P M
R A
O R
G
O R
R A
P M
Please help me out with this
in C nd JAVA
Hello, it's been 4 years.. hope you had cleared this problem. If you still haven't, reply here, I'll send you the code and explain it to you.
With my like u complete 1k like🙂
omg your
english ankcent.........
how to draw pattern
sssss
s s
s s
s s
sssss
for(int i=0;i
VASH HAMANYAK
bhai ya urdu ma ya hindi ma hi bol lety..
*******
*****
***
*
***
*****
*******
Quality bahoot kharab hai
c is difficult aaaaaaaaaaaaaa
omg your accent dude :(
Q English ko chod rha hai.Hindi ma baat ker kuch samj v aa jaye..ya English seekh k bol.
Need to improve
Bad
thank you sir
*
* *
* *
* *
* *
*******