程序

#include<stdio.h>

int mian()

{
    int  m;
    double  x, y,s;
    printf("Enter  x:");
   scanf("%lf",&x);
   printf("Enter  m:");
   scanf("%d",&m);
   if(x<=3){
      y=10;
  }
   else
      if(x<=10){
      y=10+(x-3)*2;
  }
else{
      y=24+(x-10)*3;
  }
    if(m%5==0){
      s=y+2*m/5;
   }
else{
s=y+(m-m%5)*2/5;
}
printf("s=%.0f\n",s);

return 0;
}
 

 

#include<stdio.h>
#include<math.h>
int main()
{
double x1,x2 ,x3,y1,y2 ,y3,m,n,a,b,c,s;
printf("Enter x1,y1:");
scanf("%lf%lf" ,&x1,&y1);
printf("Enter x2 ,y2:");
scanf("%lf%lf" ,&x2 ,&y2);
printf("Enter x3,y3:");
scanf ("%lf%lf" , &x3 ,&y3);
if((x2-x1)*(y3-y2)- (y2-y1)*(x3-x2)==0)
   printf("Impossible\n");
else{                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
a=sqrt(pow(x2-x1 ,2)+pow(y2-y1,2));
b=sqrt(pow(x3-x1 ,2)+pow(y3-y1,2));
c=sqrt(pow(x3-x2 ,2)+pow(y3-y2,2));
m=a+b+c;
s=m/2;
n=sqrt(s*(s-a)*(s-b)*(s-c));
printf("Is  Triangle\n");
printf("m=% .2f ,n=% .2f'' ,m,n);
return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
posted @ 2019-04-10 13:58  唐雨杰  阅读(195)  评论(1编辑  收藏  举报