Niuke test bank small plane

Niuke.com Question Bank Small Airplane Solution

 share

#include <stdio.h>
int main() {
    //一共有六行,用for循环先走六趟,然后在用\n换行,已经完成了打印六行的操作
	for (int i=0;i<6;i++) {
    //我的想法是因为for循环执行了6次,就可以用if条件判断每一趟的操作
    //i是趟数
		if (i ==0)
		{
			for (int j = 0; j < 5; j++)
			{
				printf(" ");
			}
			printf("**");
		}
		else if(i==1)
		{
			for (int j = 0; j < 5; j++)
			{
				printf(" ");
			}
			printf("**");
		}
		else if(i==2)
		{
			for (int j = 0; j < 12; j++)
			{
				printf("*");
			}
		}
		else if (i == 3)
		{
			for (int j = 0; j < 12; j++)
			{
				printf("*");
			}
			
		}
		else if (i == 4)
		{
			for (int j = 0; j < 4; j++)
			{
				printf(" ");
				
			}
			printf("*  *");
		}
		else if (i == 5)
		{
			for (int j = 0; j < 4; j++)
			{
				printf(" ");

			}
			printf("*  *");
		}
		printf("\n");
	}
}

There are many simple methods that I came up with, but I only like simplicity.

Also please advise, this question is very simple, I hope my sharing can help you

おすすめ

転載: blog.csdn.net/m0_66977204/article/details/130352128