View Code of Problem 42

#include <stdio.h>
#include<math.h>

int main(){
  int a,b,c;
  scanf("%d%d%d",&a,&b,&c);
  float x1,x2;
  float d;
  d = sqrt(b*b-4*a*c);
  x1 = (float)(-b+d)/2a;
  x2 = (float)(-b-d)/2a;
  printf("%f %F",x1,x2);
}
/*
Main.c: In function 'main':
Main.c:10:22: error: invalid suffix "a" on integer constant
   x1 = (float)(-b+d)/2a;
                      ^
Main.c:11:22: error: invalid suffix "a" on integer constant
   x2 = (float)(-b-d)/2a;
                      ^
*/

Double click to view unformatted code.


Back to problem 42