View Code of Problem 42

#include<stdio.h>
#include<stdio.h>
int main(){
  int a,b,c,d,c1,c2;
  scanf("%d %d %d",&a,&b,&c);
  d=b*b-4*a*c;
  if(d>0){
    c1=-b+sort(d)/4*a;
    c1=-b-sort(d)/4*a;
    if(c1>c2)
      printf("%.2lf %.2lf",c1,c2);
    else
     printf("%.2lf %.2lf",c2,c1);
    
  }
  else{
    printf("ERROR");
  }
  
  return 0;
}
/*
Main.c: In function 'main':
Main.c:8:5: warning: implicit declaration of function 'sort' [-Wimplicit-function-declaration]
     c1=-b+sort(d)/4*a;
     ^
Main.c:11:7: warning: format '%lf' expects argument of type 'double', but argument 2 has type 'int' [-Wformat=]
       printf("%.2lf %.2lf",c1,c2);
       ^
Main.c:11:7: warning: format '%lf' expects argument of type 'double', but argument 3 has type 'int' [-Wformat=]
Main.c:13:6: warning: format '%lf' expects argument of type 'double', but argument 2 has type 'int' [-Wformat=]
      printf("%.2lf %.2lf",c2,c1);
      ^
Main.c:13:6: warning: format '%lf' expects argument of type 'double', but argument 3 has type 'int' [-Wformat=]
Main.c:10:7: warning: 'c2' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if(c1>c2)
       ^
/tmp/ccHNqgHS.o: In function `main':
Main.c:(.text+0x5f): undefined reference to `sort'
Main.c:(.text+0x92): undefined reference to `sort'
collect2: error: ld returned 1 exit status
*/

Double click to view unformatted code.


Back to problem 42