#include <stdio.h> int main(){ int n; if (scanf("%d",&n)!=EOF && n>=1 && n<100){ for(int i=1;i<=n;i++){ // 打印空格 for (int j=0;j<n-i;j++){ printf("%c",' '); } // 打印*号 for (int j=0;j<2*i-1;j++){ printf("%c",'*'); } printf("\n"); } for(int i=n-1;i>=1;i--){ // 打印空格 for (int j=0;j<n-i;j++){ printf("%c",' '); } for (int j=0;j<2*i-1;j++){ printf("%c",'*'); } printf("\n"); } } else{ printf("input wrong"); } return 0; }
c语言编程练习题:7-132 画菱形
作者:yunjinqi
类别:编程
日期:2023-05-31 16:58:12
阅读:586 次
消耗积分:0 分
版权所有,转载本站文章请注明出处:云子量化, https://www.yunjinqi.top/article/257
最新文章
系统当前共有 404 篇文章