Current location - Recipe Complete Network - Complete cookbook of home-style dishes - C language problem print graphics, the menu includes: right triangle, isosceles triangle, input the number of lines of the graphics and input the printed characters to print the graphics.
C language problem print graphics, the menu includes: right triangle, isosceles triangle, input the number of lines of the graphics and input the printed characters to print the graphics.
I can write the code for you,

# include <; stdio.h>

int main()

{

int i,j,k,n;

scanf("%d",& n);

for(i=1; i< =n; i++)

for(j=1; j< =i-n; j++)

printf(" ");

for(k=1; k< =2*i-1; k++)

printf("*");

printf("\n");

}

This is an isosceles triangle;

int i,j,n;

scanf("%d"& n);

for(i=1; i< =n; i++)

{

for(j=1; j< =i; j++)

{

printf(" ");

printf("*");

}

printf("\n");

}

This is a right triangle; Use two for, an outer loop and an inner loop. This is the foundation, come on!