030
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 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 ("%d ", i);
}
printf ("\n");
}
}
031
Write a C Program to print the Following Pattern?
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
#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 ("%d ", k);
}
printf ("\n");
}
}
032
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 n = 5;
int i, j, k;
for (i = n - 1; i >= 0; 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");
}
}
033
Write a C Program to print the Following Pattern?
A B C D E
A B C D
A B C
A B
A
#include <stdio.h>
void main ()
{
int n = 5;
int i, j, k;
for (i = n - 1; i >= 0; 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");
}
}
034
Write a C Program to print the Following Pattern?
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
#include <stdio.h>
void main ()
{
int min_stars = 1;
int p_height = 5;
int p_space = p_height - 1;
int i, j, k;
for (i = 0; i < p_height; i++)
{
for (j = p_space; j > i; j--)
{
printf (" ");
}
for (k = 0; k < min_stars; k++)
{
printf ("* ");
}
min_stars += 2;
printf ("\n");
}
}
//-- -- -- -Another Logic-- -- -- -//
#include<stdio.h>
int main ()
{
int n = 5;
int px = n;
int py = n;
int i, j;
for (i = 1; i <= n; i++)
{
for (j = 1; j < n * 2; j++)
{
if (j >= px && j <= py)
{
printf ("* ");
}
else
{
printf (" ");
}
}
px--;
py++;
printf ("\n");
}
return 0;
}
035
Write a C Program to print the Following Pattern?
1
2 2 2
3 3 3 3 3
4 4 4 4 4 4 4
5 5 5 5 5 5 5 5 5
#include <stdio.h>
void main ()
{
int n = 5; //size
int z = 1;
int i, j, k;
for (i = 1; i <= n; i++)
{
for (j = n - 1; j >= i; j--)
{
printf (" ");
}
for (k = 0; k < z; k++)
{
printf ("%d ", i);
}
z += 2;
printf ("\n");
}
}
036
Write a C Program to print the Following Pattern?
1
3 3 3
5 5 5 5 5
7 7 7 7 7 7 7
9 9 9 9 9 9 9 9 9
#include <stdio.h>
void main ()
{
int n = 5; //size
int z = 1;
int i, j, k;
for (i = 1; i <= n; i++)
{
for (j = n - 1; j >= i; j--)
{
printf (" ");
}
for (k = 1; k <= z; k++)
{
printf ("%d ", z);
}
z += 2;
printf ("\n");
}
}
037
Write a C Program to print the Following Pattern?
A
B B B
C C C C C
D D D D D D D
E E E E E E E E E
#include <stdio.h>
void main ()
{
int m = 1;
int p_height = 5;
int p_space = p_height - 1;
int i, j, k;
for (i = 0; i < p_height; i++)
{
for (j = p_space; j > i; j--)
{
printf (" ");
}
for (k = 0; k < m; k++)
{
printf ("%c ", i + 65); //65 is the ASCII of 'A'
}
m += 2;
printf ("\n");
}
}
038
Write a C Program to print the Following Pattern?
A
C C C
E E E E E
G G G G G G G
I I I I I I I I I
#include <stdio.h>
void main ()
{
int m = 0;
int p_height = 5;
int p_space = p_height - 1;
int i, j, k;
for (i = 0; i < p_height; i++)
{
for (j = p_space; j > i; j--)
{
printf (" ");
}
for (k = 0; k <= m; k++)
{
printf ("%c ", m + 65); //65 is the ASCII of 'A'
}
m += 2;
printf ("\n");
}
}
039
Write a C Program to print the Following Pattern?
1
1 2 3
1 2 3 4 5
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9
#include <stdio.h>
void main ()
{
int n = 5; //size
int z = 1;
int i, j, k;
for (i = 1; i <= n; i++)
{
for (j = n - 1; j >= i; j--)
{
printf (" ");
}
for (k = 1; k <= z; k++)
{
printf ("%d ", k);
}
z += 2;
printf ("\n");
}
}
.png)