View Code of Problem 42

#include<stdio.h>
int main()
{
  float a,b,c,x1,x2;
  scanf("%f%f%f",&a,&b,&c);
  x1=(-b+sqrt(b*b-4*a*c))/(2*a);
  x2=(-b+sqrt(b*b-4*a*c))/(2*a);
  printf("%.2f%.2f',x1,x2);
         return 0;
}
/*
Main.c: In function 'main':
Main.c:6:3: warning: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration]
   x1=(-b+sqrt(b*b-4*a*c))/(2*a);
   ^
Main.c:6:10: warning: incompatible implicit declaration of built-in function 'sqrt'
   x1=(-b+sqrt(b*b-4*a*c))/(2*a);
          ^
Main.c:8:10: warning: missing terminating " character
   printf("%.2f%.2f',x1,x2);
          ^
Main.c:8:3: error: missing terminating " character
   printf("%.2f%.2f',x1,x2);
   ^
Main.c:9:10: error: expected expression before 'return'
          return 0;
          ^
Main.c:10:1: error: expected ';' before '}' token
 }
 ^
Main.c:4:18: warning: variable 'x2' set but not used [-Wunused-but-set-variable]
   float a,b,c,x1,x2;
                  ^
Main.c:4:15: warning: variable 'x1' set but not used [-Wunused-but-set-variable]
   float a,b,c,x1,x2;
               ^
*/

Double click to view unformatted code.


Back to problem 42