第十类、图形输出(09 道)
1.左上三角
**
*
include <stdio.h>
void main() {
int i, j;
for (i = 10; i >= 1; i--) {
for (j = 1; j <= i; j++)
printf("*");
if (i != 1)
printf("\n");
}
}
2.左下三角
*
**
include <stdio.h>
void main() {
int i, j;
for (i = 1; i <= 10; i++) {
for (j = 1; j <= i; j++)
printf("*");
if (i != 10)
printf("\n");
}
}
3.右上三角
*
*
*
**
*
**
*
include <stdio.h>
void main() {
int i, j;
for (i = 10; i >= 1; i--) {
for (j = 1; j <= 10 - i; j++)
printf(" ");
for (j = 1; j <= i; j++)
printf("*");
if (i != 1)
printf("\n");
}
}
4.右下三角
*
**
*
**
*
*
include <stdio.h>
void main() {
int i, j;
for (i = 1; i <= 10; i++) {
for (j = 1; j <= 10 - i; j++)
printf(" ");
for (j = 1; j <= i; j++)
printf("*");
if (i != 10)
printf("\n");