Left Half Diamond Pattern
Here you will learn to print a Left Half Diamond Pattern in C programming language.
Program Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include <stdio.h> int main() { int i, j, k, num; printf("Enter the number of rows: "); scanf("%d", &num); for (i = 1; i <= num; i++) { for (j = i; j < num; j++) printf(" "); for (k = 1; k <= i; k++) printf("*"); printf("\n"); } for (i = num; i >= 1; i--) { for (j = i; j <= num; j++) printf(" "); for (k = 1; k < i; k++) printf("*"); printf("\n"); } return 0; } |
Output