In this article, TechWithCode is going to provide the full concepts of How to write a C program for all patterns one by one.
Today we will draw the following different types of patterns using the number, star (*), and alphabets using C programming:
With the help of this Logic, you can also print these Pattern in Cpp, Python, JAVA, and Many programming Languages

## 2. Programs in c of pattern Pyramid

This is a C Program source code of Pyramid Pattern. when you run this code it will ask you how many numbers of the row you want to print. It will print the row as you entered during the run time.

## 3. Programs in c of pattern Inverted pyramid

This is a C Program source code of Inverted Pyramid Pattern. when you run this code it will ask you how many numbers of the row you want to print. It will print the row as you entered during the run time.

## 4. Programs in c of pattern Diamond

The diamond pattern in C programming can be printed by two methods. The first method to print a diamond pattern is by without using recursion and the Second method is by using recursion.
Here I am using the first method that means without recursion to print the diamond pattern using the * Star symbol.

## 5.pattern programs in c of Pascal's Triangle

• Programs in c of pattern Pascal's Triangle using *
This is a C Program source code of  Pascal's Triangle Pattern. when you run this code it will ask you how many numbers of the row you want to print. It will print the row as you entered during the run time.

## 6.pattern programs in c of Floyd's triangle

• Programs in c of pattern Floyd's triangle using *
This is a C Program source code of Floyd's triangle Pattern. when you run this code it will ask you how many numbers of the row you want to print. It will print the row as you entered during the run time.

## 7.pattern programs in c of Swastika

*       * * * *
*       *
*       *
* * * * * * *
*       *
*       *
* * * *       *
This is a C Program source code of Swastika Pattern. when you run this code it will ask you how many numbers of the row you want to print. It will print the row as you entered during the run time.
• Programs in c of pattern Swastika using *
#include<stdio.h>
int main() {
int n;
scanf("%d",&n);

for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
if(i==1)
{
if(j>(n/2)||j==1)
printf("* ");
else
printf("  ");
}
else if(i==n)
{
if(j<=(n/2+1)||j==n)
printf("* ");
else
printf("  ");
}
else if(i==(n+1)/2)
printf("* ");

else if(i<=n/2&&i!=1)
{
if(j==1||j==(n+1)/2)
printf("* ");
else
printf("  ");
}
else
{
if(j==n||j==(n+1)/2)
printf("* ");
else
printf("  ");
}
}
printf("\n");
}
return 0;
}

## 8.pattern programs in c of the following pattern

5       5
54     45
543   345
5432 2345
543212345
5432 2345
543   345
54     45
5       5

• Programs in c of the above pattern
This is a C Program source code of the above pattern Pattern. when you run this code it will ask you how many numbers of the row you want to print. It will print the row as you entered during the run time.

#include <stdio.h>
int main()
{
int i,j,n;
scanf("%d",&n);

for(i=n;i>=1;i--) {
for(j=n;j>=1;j--) {
if(j>=i)
printf("%d",j);
else
printf(" ");
}
for(j=2;j<=n;j++) {
if(j>=i)
printf("%d",j);
else
printf(" ");
}
printf("\n");
}

//down
for(i=2;i<=n;i++) {
for(j=n;j>=1;j--) {
if(j>=i)
printf("%d",j);
else
printf(" ");
}
for(j=2;j<=n;j++) {
if(j>=i)
printf("%d",j);
else
printf(" ");
}
printf("\n");
}
}

## 9.pattern programs in c of the following pattern

1
8 2
14 9 3
19 15 10 4
23 20 16 11 5
26 24 21  17 12 6
28 27 25 22 18 13 7

• Programs in c of the above pattern
This is a C Program source code of the above pattern Pattern. when you run this code it will ask you how many numbers of the row you want to print. It will print the row as you entered during the run time.

#include<stdio.h>
int main() {

int n,i,j,k,l=1,d;
scanf("%d",&n);
for(i=0;i<n;++i)
{
for(j=i-1;j>=0;--j)
{
d=n-1;
l=i+1;
for(k=0;k<=j;++k)
{
l+=d;
d--;
}
printf("%d ",l);
}
printf("%d\n",i+1);
}
return 0;
}

## 10. Pattern programs in c of the following pattern

1
3 2
4 5 6
10 9 8 7
11 12 13 14 15
21 20 19 18 17 16

• Programs in c of the above pattern

#include<stdio.h>
int main()
{
int i,j,k,l,n;

scanf("%d",&n);

for(k=i=1;i<=n;i++)
{
l=k+i-1
for(j=1;j<=i;j++)
{
if(i%2==1)
printf("%d ",k);
else
printf("%d ",l);
k++;
l--;
}
printf("\n");
}
return 0
}

Final Word:-

In this article, We have explained to you how to write a C program to print multiple patterns. We hope you like it

Don't forget to share how you like this Content in the comment below. If you have any doubt or suggestion then please write in the comment section below, we will love to hear from you.