C Practical and Assignment Programs-Pattern Printing 9

C Practical and Assignment Programs-Pattern Printing 9
In this video we are going to write a program to print a pattern in form of diamond shape consisting of “*”. We are going to use nested for loops ie one loop inside another.The full description of question is provided below. Now this program is written in C programming language but will work in C++.Fell free to provide you suggestion.

Q. To print various patterns using loop constructs like:
*
***
*****
*******
**********
*******
*****
***
*

Source Code: http://wethecomputerguys.com/2014/03/31/c-practical-and-assignment-programs-pattern-printing-9/

Facebook Page; https://www.facebook.com/wethecomputerguys

Pattern Printing 8 :http://youtu.be/_64p6mahlV4

Playlist: https://www.youtube.com/playlist?list=PLPgpWDN1BdTvWebvqTXQie6yIjx6yOXFZ

Blog: http://wethecomputerguys.com

http://youtu.be/Hpr5m_PE4As
We The Computer Guys
Shreyas Zagade
Aakash Thakur
Ananya Jain

Comments

naif borkar says:

how to print the following pattern      A    
                                                   ABA
                                                 ABCBA
                                               ABCDCBA
                                             ABCDEDCBA
                                           ABCDEFEDCBA        
                                              

Deepak Suri says:

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.

Sunil sharma says:

Very very thanks for helping .

ShinKickerX says:

VASH HAMANYAK

Biprodip Sanyashi says:

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?

venkata ramanaiah says:

c is difficult aaaaaaaaaaaaaa

AKTxITACHI says:

I wrote it exactly as he did and I’m getting “2:14: error: ‘::main’ must return ‘int'” on line 2, what am I doing wrong?

malkeet singh says:

Marvellous guys.

aruna mallela says:

Sir please explain the below pattern
1
1 * 2
1 * 2 * 3
1 * 2 * 3 * 4
1 * 2 * 3 * 4 * 5

Husnul Abid says:

if n = 5

10101
01010
10101
01010
10101

if n =3

101
010
101

Do it …

ASHIS SAHOO says:

how to draw pattern
sssss
s s
s s
s s
sssss

Nikhil Goyal says:

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.

Bilal Hassan says:

Great work .. <3

Meri የቴዲ ኣፍሮ ኣደናቂ says:

*

* *

* * *

* * * *

* * * * * *

* * * *

* * *

* *

*
and
                     *

                  * *

              * * *

           * * * *

     * * * * * *

           * * * *

              * * *

                  * *

                     *

pls

abhik nayak says:

ABCDEFGFEDCBA
ABCDEF   FEDCBA
ABCDE       EDCBA
ABCD            DCBA
ABC                  CBA
AB                       BA
A                             A
Respected sir,please solve this pattern

Dilhani De Silva says:

thank you sir

TheZekf says:

omg your accent dude 🙁

Upputuri Veera says:

How

Asif Hossain says:

#include
#include
int main()
{
int i,j,k,line;
printf(“enter line:”);
scanf(“%d”,&line);
for(i=1;i< =line;i++) { for(j=line;j>=i;j–)
{
printf(” “);
}
for(k=1;k< =2*i-1;k++) { printf("*"); } printf("n"); } for(i=line-1;i>=1;i–)
{
for(j=i;j< =line;j++) { printf(" "); } for(k=2*i-1;k>=1;k–)
{
printf(“*”);
}
printf(“n”);
}

}
is there any problem with my code?

Sky Lar says:

Sir , in the first nested loop to print * – last video u told the logic is.. for(colstar=1;colstar<=row;colstar++) but in this video ur saying... for(colstar=1;colstar<=2*row-1;colstar++)....which one is right ?! plz answer!

nagapuri sai vishal says:

Please i need Code make video for below pattern
1 1
33 33
555555
33 33
1 1

zeko salemeh says:

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

Vignesh Seralathan says:

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

Mohit Kiradoo says:

not a correct code i think. The program is not running correctly
plz help

Serdar Karakas says:

lan bu ne biçim ingilizce 12 dakika 43 saniye boyunca işkence ettin be bilader.
thanks for video, great india namaste

Shaleen Shukla says:

sir please make a video on
i
in
Ind
Indi
india

Seek Nithyashri says:

sir why u r naming the lower half as 4 3 2 1…can we name it as 1 2 3 4….

Hilla Apple says:

thanks Sir

shitiz gupta says:

can you plz tell me how to print this

&&&&&&&
&&&&&
&&&
&

maniraho didier says:

kardeşim teşekkür ederim

Prof Stat says:

guys pls tell me how to find this output without using any spaces

*
**
*
**
*

abhishek gupta says:

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 ..

 Write a comment

*

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!