C program to print reverse pyramid star pattern - DEEP CODER

Breaking

printf("Learn Deep Coding Here!!");

C program to print reverse pyramid star pattern

C program to print reverse pyramid star pattern




#include<stdio.h>
int main() {
    int i, space, rows, star;
    printf("Enter the number of rows\n");
    scanf("%d",&rows);
  
    for(i = rows;i >= 1; i--) {
        /* Printing spaces */
        for(space = 0; space <= rows-i; space++) {
           printf(" ");
        }
        /* Printing stars */
        star = 0;
        while(star != (2*i - 1)) {
            printf("*");
            star++;
        }
        printf("\n");
    }
     
    return 0;
}


OUTPUT :


Enter the number of rows : 6

*********
*******
*****
***
*

No comments:

Post a Comment