020
Write a C Program to print the Following Pattern?
5 5 5 5 5
4 4 4 4
3 3 3
2 2
1
#include <stdio.h>
void main ()
{
int i, j;
for (i = 5; i >= 1; i--)
{
for (j = 1; j <= i; j++)
{
printf ("%d ", i);
}
printf ("\n");
}
}
021
Write a C Program to print the Following Pattern?
5 4 3 2 1
5 4 3 2
5 4 3
5 4
5
#include <stdio.h>
void main ()
{
int i, j;
for (i = 1; i <= 5; i++)
{
for (j = 5; j >= i; j--)
{
printf ("%d ", j);
}
printf ("\n");
}
}
022
Write a C Program to print the Following Pattern?
E E E E E
D D D D
C C C
B B
A
#include <stdio.h>
void main ()
{
int i, j;
for (i = 4; i >= 0; i--)
{
for (j = 0; j <= i; j++)
{
printf ("%c ", i + 65);
}
printf ("\n");
}
}
023
Write a C Program to print the Following Pattern?
E D C B A
E D C B
E D C
E D
E
#include <stdio.h>
void main ()
{
int i, j;
for (i = 0; i <= 4; i++)
{
for (j = 4; j >= i; j--)
{
printf ("%c ", j + 65);
}
printf ("\n");
}
}
024
Write a C Program to print the Following Pattern?
*
* *
* * *
* * * *
* * * * *
#include <stdio.h>
void main ()
{
int n = 5; //size
int i, j, k;
for (i = 1; i <= n; i++)
{
for (j = n - 1; j >= i; j--)
{
printf (" ");
}
for (k = 1; k <= i; k++)
{
printf ("* ");
}
printf ("\n");
}
}
//--Another Logic using if - else -- //
#include<stdio.h>
void main ()
{
int n = 5; //size
int i, j, k;
for (i = 1; i <= n; i++)
{
for (j = n; j >= 1; j--)
{
if (i >= j)
printf ("* ");
else
printf (" ");
}
printf ("\n");
}
}
025
Write a C Program to print the Following Pattern?
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
#include <stdio.h>
void main ()
{
int n = 5; //size
int i, j, k;
for (i = 1; i <= n; i++)
{
for (j = n - 1; j >= i; j--)
{
printf (" ");
}
for (k = 1; k <= i; k++)
{
printf ("%d ", i);
}
printf ("\n");
}
}
026
Write a C Program to print the Following Pattern?
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
#include <stdio.h>
void main ()
{
int n = 5;
int i, j, k;
for (i = 1; i <= n; i++)
{
for (j = n - 1; j >= i; j--)
{
printf (" ");
}
for (k = 1; k <= i; k++)
{
printf ("%d ", k);
}
printf ("\n");
}
}
027
Write a C Program to print the Following Pattern?
A
B B
C C C
D D D D
E E E E E
#include <stdio.h>
void main ()
{
int n = 5;
int i, j, k;
for (i = 0; i < n; i++)
{
for (j = n - 1; j > i; j--)
{
printf (" ");
}
for (k = 0; k <= i; k++)
{
printf ("%c ", i + 65); //65->ASCII of 'A'
}
printf ("\n");
}
}
028
Write a C Program to print the Following Pattern?
A
A B
A B C
A B C D
A B C D E
#include <stdio.h>
void main ()
{
int n = 5;
int i, j, k;
for (i = 0; i < n; i++)
{
for (j = n - 1; j > i; j--)
{
printf (" ");
}
for (k = 0; k <= i; k++)
{
printf ("%c ", k + 65); //65->ASCII of 'A'
}
printf ("\n");
}
}
029
Write a C Program to print the Following Pattern?
* * * * *
* * * *
* * *
* *
*
#include <stdio.h>
void main ()
{
int n = 5;
int i, j, k;
for (i = n; i >= 1; i--)
{
for (j = n - 1; j >= i; j--)
{
printf (" ");
}
for (k = 1; k <= i; k++)
{
printf ("* ");
}
printf ("\n");
}
}
//-- Another Logic using if-else--//
#include <stdio.h>
void main ()
{
int n = 5;
int i, j, k;
for (i = n; i >= 1; i--)
{
for (j = n ; j >= 1; j--)
{
if (i >= j)
printf ("* ");
else
printf (" ");
}
printf ("\n");
}
}
.png)