View Code of Problem 42

#include<stdio.h>
#include<math.h>
int main()
{
  float a,b,c;
  float d,e,x1,x2;
  scanf("%f%f%f",&a,&b,&c);
  d=-b+sqrt(b*b-4*a*c);
  e=-b-sqrt(b*b-4*a*c);
  x1=d/(2*a);
  x2=e/(2*a);
  if(x1<=x2){
     t=x1;
     x1=x2;
     x2=t;
  }
  printf("%.2f %.2f",x1,x2);
}
  
/*
Main.c: In function 'main':
Main.c:8:3: error: stray '\357' in program
   d=-b+sqrt(b*b-4*a*c);
   ^
Main.c:8:3: error: stray '\274' in program
Main.c:8:3: error: stray '\233' in program
Main.c:9:3: error: expected ';' before 'e'
   e=-b-sqrt(b*b-4*a*c);
   ^
Main.c:13:6: error: 't' undeclared (first use in this function)
      t=x1;
      ^
Main.c:13:6: note: each undeclared identifier is reported only once for each function it appears in
*/

Double click to view unformatted code.


Back to problem 42