In this article, TechWithCode is going to provide the full concepts of How to write 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:

## 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 * Star symbol.

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

• Programs in c of pattern Pascal's Triangle using *

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

• Programs in c of pattern Floyd's triangle using *

## 7.pattern programs in c of Swastika

*       * * * *
*       *
*       *
* * * * * * *
*       *
*       *
* * * *       *

• 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 above pattern
#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 above pattern
#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