#include<stdio.h> int main() { int i,j,n; printf("Enter value of n rows: "); scanf("%d",&n); for(i=1; i<=n; i++) { for(j=i;j<=n;j++) { printf(" "); } for(j=1; j<=i; j++) { printf("*"); } for(j=1; j<i; j++) { printf("*"); } printf("\n"); } return 0; }
Output:
Enter value of n rows: 5 * *** ***** ******* ********* Process returned 0 (0x0) execution time : 2.581 s Press any key to continue.