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