• 实验3


    #include <stdio.h>
    int main(){
    	double a,b,c;
        scanf("%lf %lf %lf",&a,&b,&c);
    	
      if(a+b>c && a+c>b && b+c>a) {
      	if(a==b &&a==c)
      	  printf("构成等边三角形\n");
        else if(a==b || b==c)
           printf("构成等腰三角形\n");
        else
           printf("构成一般三角形\n");
      }
      else
          printf("不能构成三角形\n");
          
        return 0;
    }
    

      

    #include <stdio.h>
     int main(){ 
    double a,b,c; 
    printf("输入三角形三边:\n"); 
    while(scanf("%lf%lf%lf",&a,&b,&c)){
     if(a+b>c && a+c>b && b+c>a) { 
    if(a==b &&a==c) printf("构成等边三角形\n"); 
    else if(a==b || b==c) printf("构成等腰三角形\n"); 
    else printf("构成一般三角形\n"); } 
    else 
    printf("不能构成三角形\n"); 
    printf("\n输入三角形三边:\n");
     }
     return 0; 
    }
      
    

      

    会一直重复如果不停止的话

    #include<stdio.h>
    int main(){
    	int number,max, min, n;
    	n = 1;
    	printf("输出第%d个数:",n);
    	scanf("%d",&number);
    	max = number;
    	min = number;
    	
    	while(n<5){
    		n++;
    		printf("输入第%d个数:",n);
    		scanf("%d",&number);
    		if(number>max)
    		   max = number;
    		else if(number<min)
    		   min = number;
    	}
    	printf("最大数为:%d\n",max);
    	printf("最小数为:%d\n",min);
    	return 0;
    }
    

      

    #include<stdio.h>
    int main(){
    	int x,y = 1;
    	int count=0;
    	printf("输出的素数为:\n");
    	for(x = 101;x <= 200;x++)
    	{
    		for(y = 2;y <= x;y++)
    		{
    			if(x%y == 0)
    			break;
    		}
    		if(x == y){
    			count++;
    			printf("%6d",x);
    		if(count%5==0)
    		printf("\n");
    		}
    	}
     printf("\n""101-200之间有%d个素数",count);
    	return 0; 
    }
    

      

    #include<stdio.h>
    int main(){
    	int x, y, z;
    	int a, b;
    	for(x = 1;x <= 5;x++)
    	{   a=5-x;
    	    b=2*x-1;
    		for(y = 1;y <= a;y++)
    		
    			printf(" ");
    	 
    		for(z = 1;z <= b;z++)
    		{
    			printf("*");
    		}
    		printf("\n");
    	}
    	return 0;
    }
    

      

  • 相关阅读:
    线程的补充
    线程
    进程
    操作系统和进程
    socketserver模块实现并发和连接合法性验证
    socketserver实例化过程
    粘包现象和解决方法
    网络通信协议
    初探网络
    Python网络编程
  • 原文地址:https://www.cnblogs.com/suzhen/p/10707771.html
Copyright © 2020-2023  润新知