First of all, please do not just copy paste the code. Try to understand it. You can do this to write numbers in a triangle shape;
#include <stdio.h>
int main()
{
int i, j, rows;
// User input the number of rows
printf("Enter the number of rows: ");
scanf("%d", &rows);
// Iterate through the rows
for (i = 0; i < rows; i++)
{
// Print numbers in each row
for (j = 0; j <= i; j++)
{
printf("%d ", j);
}
// Print new line after each row
printf("\n");
}
return 0;
}