From a030e3c89ff183f59ae48d24f9172e66bd712198 Mon Sep 17 00:00:00 2001 From: patvgnw5f <483018233@qq.com> Date: Thu, 17 Feb 2022 17:16:23 +0800 Subject: [PATCH] =?UTF-8?q?Add=20=E8=BE=93=E5=87=BA=E8=8F=B1=E5=BD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 输出菱形 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 输出菱形 diff --git a/输出菱形 b/输出菱形 new file mode 100644 index 0000000..1ccbf6e --- /dev/null +++ b/输出菱形 @@ -0,0 +1,29 @@ +#include +int main() +{ + int i,j; + for(i = 1; i <= 3; i++) + { + for(j = 1; j <= (4 - i); j++){ + printf(" "); + } + for(j = 1;j <= (-1 + 2 * i); j++) + { + printf("*"); + } + printf("\n"); + } + for(i = 1; i <= 2; i++) + { + for(j = 1;j <= ( 2 + i - 1 );j++) + { + printf(" "); + } + for(j = 1;j <= ( 5 - 2 * i );j++) + { + printf("*"); + } + printf("\n"); + } +return 0; +} \ No newline at end of file