C Programming Code To Create Pyramid and Pattern: Programs To Print Triangles Using, Numbers and Characters
C Programming Code To Create Pyramid and Pattern: Programs To Print Triangles Using, Numbers and Characters
SHARES
*
* *
* * *
* * * *
* * * * *
#include <stdio.h>
int main()
{
int i, j, rows;
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
#include <stdio.h>
int main()
{
int i, j, rows;
A
B B
C C C
D D D D
E E E E E
#include <stdio.h>
int main()
{
int i, j;
char input, alphabet = 'A';
printf("Enter the uppercase character you want to print in last row: "
scanf("%c",&input);
printf("\n");
}
return 0;
}
* * * * *
* * * *
* * *
* *
*
#include <stdio.h>
int main()
{
int i, j, rows;
return 0;
}
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
#include <stdio.h>
int main()
{
int i, j, rows;
return 0;
}
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
#include <stdio.h>
int main()
{
int i, space, rows, k=0;
while(k != 2*i‐1)
{
printf("* ");
++k;
}
printf("\n");
}
return 0;
}
1
2 3 2
3 4 5 4 3
4 5 6 7 6 5 4
5 6 7 8 9 8 7 6 5
#include <stdio.h>
int main()
{
int i, space, rows, k=0, count = 0, count1 = 0;
while(k != 2*i‐1)
{
if (count <= rows‐1)
{
printf("%d ", i+k);
++count;
}
else
{
++count1;
printf("%d ", (i+k‐2*count1));
}
++k;
}
count1 = count = k = 0;
printf("\n");
}
return 0;
* * * * * * * * *
* * * * * * *
* * * * *
* * *
*
#include<stdio.h>
int main()
{
int rows, i, j, space;
printf("\n");
}
return 0;
}
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
#include <stdio.h>
int main()
{
int rows, coef = 1, space, i, j;
printf("%4d", coef);
}
printf("\n");
}
return 0;
}
1
2 3
4 5 6
7 8 9 10
#include <stdio.h>
int main()
{
int rows, i, j, number= 1;
printf("\n");
}
return 0;
}