# Include < Stdio. h >
Void Print_triangle ( Int N, Int X, Int T)
// N is the number of rows for each small triangle, X is the number of consecutive output triangles, and T is the right displacement of the triangle (1 indicates 1 space)
{
Int I, K, J;
For (I = 0 ; I < N; I ++ ) // Number of control lines
{
For (K = 0 ; K < T; k ++ ) // Control displacement
Printf ( " % C " , 32 ); // The space ASCII code is 32.
For (J = X; j > 0 ; J -- ) // Number of controls
{
For (K = N - 1 ; K > I; k -- )
Printf ( " % C " , 32 );
For (K = 0 ; K < I * 2 + 1 ; K ++ )
Printf ( " % C " , 42 );
For (K = N; k > I && J > 1 ; K -- )
Printf ( " % C " , 32 );
}
Printf ( " \ N " );
}
}
Int Main ()
{
Int I, k, n, T;
Printf ( " Please input N: " );
Scanf ( " % D " , & N );
For (I = 1 ; I <= N; I ++ ) // Control the number of large triangle rows
{
T = N * (N - I );
Print_triangle (n, I, T );
}
Return 0 ;
}
Understanding this column should be fine for the for loop.