2-3输出三角形

[浙大版《C语言程序设计(第3版)》题目集](https://pintia.cn/problem-sets/12/problems/type/7)
本题要求编写程序,输出指定的由“*”组成的倒三角图案。

输入格式:
本题目没有输入。

输出格式:
按照下列格式输出由“*”组成的倒三角图案。

* * * *
 * * *
  * *
   *
#include 
int main(){
    int i,j,s=4;
    for(i=1;i<=s;i++){
        for(j=1;j<2*s;j++){
            if(((i+j)%2==0)&&(j>=i)&&(j<=2*s-i))printf("*");
            else printf(" ");
        }
        printf("\n");
    }
    return 0;
}

你可能感兴趣的:(2-3输出三角形)