fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n;
  5. printf("Enter the number of rows: \n");
  6. scanf("%d",&n);
  7. for(int i=1;i<=n;i++){
  8. for( int j=1;j<=n-i;j++){
  9.  
  10. printf(" ");
  11.  
  12. }
  13.  
  14. for(int k=1;k<2*i;k++){
  15.  
  16. printf(" * ");
  17.  
  18. }
  19. printf("\n");
  20. }
  21.  
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 5296KB
stdin
4
stdout
Enter the number of rows: 
          * 
       *  *  * 
    *  *  *  *  * 
 *  *  *  *  *  *  *