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. for(int i=1;i<=n;i++){
  10. int a=1;
  11. for(int j=1;j<=i;j++){
  12. printf(" %d ",a);
  13. a++;
  14. }
  15.  
  16. for(int k=1;k<i-1;k++){
  17. printf(" * ");
  18. }
  19.  
  20. printf("\n");
  21. }
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 5320KB
stdin
7
stdout
Enter the number: 
 1 
 1  2 
 1  2  3  * 
 1  2  3  4  *  * 
 1  2  3  4  5  *  *  * 
 1  2  3  4  5  6  *  *  *  * 
 1  2  3  4  5  6  7  *  *  *  *  *