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.  
  8. int nst=n;
  9. int nsp=0;
  10.  
  11.  
  12. for(int i=1;i<=n;i++){
  13.  
  14. for(int j=1;j<=nsp;j++)
  15. printf(" ");
  16.  
  17. for(int k=1;k<=nst;k++)
  18. printf(" * ");
  19.  
  20. nst--;
  21. nsp++;
  22.  
  23. printf("\n");
  24.  
  25. }
  26.  
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 5328KB
stdin
15
stdout
Enter the number of rows: 
 *  *  *  *  *  *  *  *  *  *  *  *  *  *  * 
    *  *  *  *  *  *  *  *  *  *  *  *  *  * 
       *  *  *  *  *  *  *  *  *  *  *  *  * 
          *  *  *  *  *  *  *  *  *  *  *  * 
             *  *  *  *  *  *  *  *  *  *  * 
                *  *  *  *  *  *  *  *  *  * 
                   *  *  *  *  *  *  *  *  * 
                      *  *  *  *  *  *  *  * 
                         *  *  *  *  *  *  * 
                            *  *  *  *  *  * 
                               *  *  *  *  * 
                                  *  *  *  * 
                                     *  *  * 
                                        *  * 
                                           *