#include<stdio.h>#include<stdlib.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */intmain(int argc,char*argv[]){int i, j, n;scanf("%d",&n);//输入3 for(i = n; i >0; i--){for(j=0;j<n-i;j++){
printf (" ");}for(j=i;j>0;j--){
printf ("*");}printf("\n");}return0;}
左上直角
******
#include<stdio.h>#include<stdlib.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */intmain(int argc,char*argv[]){int i, j, n;scanf("%d",&n);//输入3 for( i = n; i >0; i--){for(j = i; j >0; j--){printf("*");}printf("\n");}return0;}
右下直角
******
#include<stdio.h>#include<stdlib.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */intmain(int argc,char*argv[]){int i, j, n;scanf("%d",&n);//输入3 for(i =1; i <= n; i++){for( j = n; j > i; j--){
printf (" ");}for( j =0; j < i; j++){
printf ("*");}printf("\n");}return0;}
左下直角
******
#include<stdio.h>#include<stdlib.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */intmain(int argc,char*argv[]){int i, j, n;scanf("%d",&n);//输入3 for(i =1; i <= n; i++){// for( j = n; j > i; j--){// printf (" ");// } for( j =0; j < i; j++){
printf ("*");}printf("\n");}return0;}
倒三角
*********
#include<stdio.h>#include<stdlib.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */intmain(int argc,char*argv[]){int i, j, n;scanf("%d",&n);//输入3 for(i = n; i >0; i--){for( j =0; j < n - i; j++){
printf (" ");}for( j =2* i; j >1; j--){
printf ("*");}printf("\n");}return0;}
正常三角
*********
#include<stdio.h>#include<stdlib.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */intmain(int argc,char*argv[]){int i, j, n;scanf("%d",&n);//输入3 for(i =1; i <= n; i++){for(j=n-i;j>0;j--){
printf (" ");}for( j =1; j <2* i; j++){
printf ("*");}printf("\n");}return0;}