第七次作业

#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,v;
	for(i=1;i<=4;i++){
		for(j=1;j<=i-1;j++){
			printf(" ");
		}
		for(v=1;v<=9-i*2;v++){
			printf("*");
		}
		printf("\n");
	}
}

 

3.
#include<stdio.h>
main(){
	int i,j;
	for(i=0;i<=35;i++){
		for(j=0;j<=35;j++){
			if(j+i==35&&4*i+2*j==94){
				printf("%d只兔子,%d只鸡.\n",i,j);
			}
		}
	}
}

 

4.
#include<stdio.h>
main(){
	int i,j,z;
	for(i=1;i<=9;i++){
		for(j=1;j<=i;j++){
			z=0;
			printf("%d*%d=%d\t",j,i,i*j);
		}
		printf("\n");
	}
}

 

5.
#include<stdio.h>
main(){
	int i,n,flag;
	flag=0;
	i=1;
	scanf("%d",&n);
	while(i<=n){
		if(n%i==0)
			flag+=1;
		i++;
	}if(flag==2){
		printf("是质数");
	}
		else{
			printf("不是质数");
		}
}

 

posted @ 2021-11-09 10:18  荽邊  阅读(10)  评论(0)    收藏  举报