求 一道计算机C语言程序题的写法write a program to print a triangle using asterisks,where the triangle has at least a height of three characters.
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/20 08:45:00
![求 一道计算机C语言程序题的写法write a program to print a triangle using asterisks,where the triangle has at least a height of three characters.](/uploads/image/z/3687795-27-5.jpg?t=%E6%B1%82+%E4%B8%80%E9%81%93%E8%AE%A1%E7%AE%97%E6%9C%BAC%E8%AF%AD%E8%A8%80%E7%A8%8B%E5%BA%8F%E9%A2%98%E7%9A%84%E5%86%99%E6%B3%95write+a+program+to+print+a+triangle+using+asterisks%2Cwhere+the+triangle+has+at+least+a+height+of+three+characters.)
求 一道计算机C语言程序题的写法write a program to print a triangle using asterisks,where the triangle has at least a height of three characters.
求 一道计算机C语言程序题的写法
write a program to print a triangle using asterisks,where the triangle has at least a height of three characters.
求 一道计算机C语言程序题的写法write a program to print a triangle using asterisks,where the triangle has at least a height of three characters.
一个左对齐的,一个右对齐的,一个倒三角左对齐,一个倒三角右对齐
你根据需要去相应的部分就行
#include "stdio.h"
int main(void)
{
int i,j,k;
for (i = 1; i = 1; k--)
printf("*");
for (j = 4 - i; j >= 1; j--)
printf(" ");
printf("\n");
}//左对齐
printf("左对齐\n");
for (i = 3; i >= 0; i--)
{
for (k = i; k >= 1; k--)
printf(" ");
for (j = 1; j = 1; i--)
{
for (k = i; k >= 1; k--)
printf("*");
for (j = 0; j = 1; i--)
{
for (k = 4 - i; k >= 1; k--)
printf(" ");
for (j = i; j >= 1; j--)
printf("*");
printf("\n");
}//倒右对齐
printf("倒右对齐\n");
return 1;
}