第8次作业

1.#include<stdio.h>

main(){

int i,j;

for(i=1;i<=5;i++){

for(j=1;j<=i;j++){

printf("*");

}

printf("\n");

}

}

 

 

2.#include<stdio.h>

main(){

int i,j,k;

for(i=1;i<=4;i++){

for(j=1;j<=i-1;j++){

printf(" ");

}

for(k=1;k<=9-2*i;k++){

printf("*");

}

printf("\n");

}

}

 

 

3.#include<stdio.h>

main()

{

int i,j;

for(i=1;i<=9;i++){

for(j=1;j<=i;j++){

printf("%d*%d=%d\t",i,j,i*j);

}

printf("\n");

}

}

 

 

4.#include<stdio.h>

main()

{

int i,j;

for(i=0;i<=35;i++){

j=35-i;

if(2*i+4*j==94)

printf(":%d只  兔子:%d\n",i,j);

}

}

 

 

5.#include<stdio.h>

main()

{

int i;

printf("请输入一个数\n");

scanf("%d",&i);

 

if(i%1==0&&i%i==0)

printf("是质数");

else

printf("不是质数");

}

 

posted @ 2021-11-09 11:29  慢慢的乌龟  阅读(29)  评论(0)    收藏  举报