View Code of Problem 24

# include<stdio.h>
# include<math.h>
int main()
{
  float a,b,c;
  float s,p;
  while(scanf("%f %f %f",&a,&b,&c)!=EOF)
  {
    p = (a+b+c)/2;
    s = sqrt(p*(p-c)*(p-b)*(p-a));
    printf("%0.2f\n",s);
  }
  return 0;
}

/*
Main.c: In function 'main':
Main.c:5:14: error: stray '\357' in program
   float a,b,c;
              ^
Main.c:5:15: error: stray '\274' in program
   float a,b,c;
               ^
Main.c:5:16: error: stray '\233' in program
   float a,b,c;
                ^
Main.c:6:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'float'
   float s,p;
   ^~~~~
Main.c:7:33: error: 'c' undeclared (first use in this function)
   while(scanf("%f %f %f",&a,&b,&c)!=EOF)
                                 ^
Main.c:7:33: note: each undeclared identifier is reported only once for each function it appears in
Main.c:9:5: error: 'p' undeclared (first use in this function)
     p = (a+b+c)/2;
     ^
Main.c:10:5: error: 's' undeclared (first use in this function)
     s = sqrt(p*(p-c)*(p-b)*(p-a));
     ^
*/

Double click to view unformatted code.


Back to problem 24