C program to print the star diamond pattern
kw.c
#include <stdio.h> int main() { int i, j; for (i = 1; i <= 7; i++) { for (j = 1; j <= 7 - i; j++) { printf(" "); } for (j = 1; j <= i; j++) { printf("* "); } printf("\n"); } for (i = 6; i >= 1; i--) { for (j = 1; j <= 6 - i; j++) { printf(" "); } for (j = 1; j <= i; j++) { printf(" *"); } printf("\n"); } }
Output
kodingwindow@kw:~$ gcc kw.c
kodingwindow@kw:~$ ./a.out * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * kodingwindow@kw:~$
Comments and Reactions
What Next?
C program to print the alphabets diamond pattern
C program to find the min and max of given numbers
C program to print alphabets using the ASCII values
Advertisement