List of Pattern Program in C Programming Language
Learn How To Print Pattern Program in C Programming Language. It is important that you should understand How A For Loop Works in C Programming before going further with this C Program To Generate Patterns of Numbers.
Note: This Java Program to Print Pattern Programs is edited with gEdit Editor and executed using Terminal in Linux Ubuntu Operating System.
Pattern 1: C Program To Print Pattern of Numbers using While Loop
1 2 3 4 5
5 4 3 2
2 3 4
4 3
3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include<stdio.h> int main() { int temp = 1, limit, m; int count = 1; printf("Enter A Limit:\t"); scanf("%d", &limit); while(limit > 0) { m = limit; while(m--) { printf("%d", count); count = count + temp; } printf("\n"); temp = temp * (-1); count = count + temp; limit--; } return 0; } |
Output

Pattern 2: C Program To Print Characters in Pattern using For Loop
ABCDDBCA
ABC CBA
AB BA
A A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include<stdio.h> int main() { int count, b, c, d; printf("\n"); for(count = 0; count <= 4; count++) { for(b = 0; b < 4 - count; b++) { printf("%c", 65 + b); } if(count >= 0) { for(c = 0; c <= 2*count-1; c++) { printf(" "); } } for(d = 3 - count; d >= 0; d--) { if(d <= 3) { printf("%c", 65 + d); } } printf("\n"); } printf("\n"); return 0; } |
Output

If you have any compilation error or doubts in this Code For Printing Pattern Program in C Programming, let us know about in the comment section below.
1
11
21
1211
111221…i want code for this..
Can anyone depict the code for the following pattern::
Sample input : 5
Output:
*####
###**
***##
###**
*####
Sample input : 3
Output:
*##
#**
*##
kaise to kiya he just check it
static void Main(string[] args)
{
int row,count,refcount=1,count1,refcount1=4,count2,refcount2=3,count3,refcount3=2;
Console.Write(“Enter the No of Rows You Want”);
row = Int32.Parse(Console.ReadLine());
for (int i = 1; i <= row; i++)
{
count3 = refcount3;
count2 = refcount2;
count1=refcount1;
count=refcount;
if (i <= 3)
{
for (int j = 1; j 0)
{
Console.Write(“*”);
}
else if (count1– > 0)
{
Console.Write(“#”);
}
}
else
{
if (count1– > 0)
{
Console.Write(“#”);
}
else if (count– > 0)
{
Console.Write(“*”);
}
}
}
Console.WriteLine();
++refcount;
–refcount1;
}
else
{
for (int j = 1; j 0)
{
Console.Write(“#”);
}
else if (count3– > 0)
{
Console.Write(“*”);
}
}
else
{
if (count3– > 0)
{
Console.Write(“*”);
}
else if (count2– > 0)
{
Console.Write(“#”);
}
}
}
Console.WriteLine();
++refcount2;
–refcount3;
}
} Console.ReadKey();
}
kaise to kiya he maine
static void Main(string[] args)
{
int row,count,refcount=1,count1,refcount1=4,count2,refcount2=3,count3,refcount3=2;
Console.Write(“Enter the No of Rows You Want”);
row = Int32.Parse(Console.ReadLine());
for (int i = 1; i <= row; i++)
{
count3 = refcount3;
count2 = refcount2;
count1=refcount1;
count=refcount;
if (i <= 3)
{
for (int j = 1; j 0)
{
Console.Write(“*”);
}
else if (count1– > 0)
{
Console.Write(“#”);
}
}
else
{
if (count1– > 0)
{
Console.Write(“#”);
}
else if (count– > 0)
{
Console.Write(“*”);
}
}
}
Console.WriteLine();
++refcount;
–refcount1;
}
else
{
for (int j = 1; j 0)
{
Console.Write(“#”);
}
else if (count3– > 0)
{
Console.Write(“*”);
}
}
else
{
if (count3– > 0)
{
Console.Write(“*”);
}
else if (count2– > 0)
{
Console.Write(“#”);
}
}
}
Console.WriteLine();
++refcount2;
–refcount3;
}
} Console.ReadKey();
}
Output:-
&#######
#######&&
&&&######
#####&&&&
&&&&&####
#####&&&&
&&&######
#######&&
&#######
class Program
{
static void Main(string[] args)
{
int center_row, row,count,refcount=1,count1,refcount1,count2,refcount2,count3,refcount3;
Console.Write(“Enter the No of Rows You Want”);
row = Int32.Parse(Console.ReadLine());
center_row = (row / 2) + 1;
refcount1 = row – 1;
refcount2 = center_row;
refcount3 = row / 2;
for (int i = 1; i <= row; i++)
{
count3 = refcount3;
count2 = refcount2;
count1=refcount1;
count=refcount;
if (i <= center_row)
{
for (int j = 1; j 0)
{
Console.Write(“&”);
}
else if (count1– > 0)
{
Console.Write(“#”);
}
}
else
{
if (count1– > 0)
{
Console.Write(“#”);
}
else if (count– > 0)
{
Console.Write(“&”);
}
}
}
Console.WriteLine();
++refcount;
–refcount1;
}
else
{
for (int j = 1; j 0)
{
Console.Write(“#”);
}
else if (count3– > 0)
{
Console.Write(“&”);
}
}
else
{
if (count3– > 0)
{
Console.Write(“&”);
}
else if (count2– > 0)
{
Console.Write(“#”);
}
}
}
Console.WriteLine();
++refcount2;
–refcount3;
}
} Console.ReadKey();
}
}
solve problem
you have just check it
can you solve these pattern
*
**
***
***
****
#include
int main()
{
int i,j;
for(i=1;i<=6;i++)
{
for(j=1;j<i;j++)
{
printf("*");
}
printf("\n");
}
}