#include <stdio.h> int main() { float a,b,c,p,s; while(scanf("%f%f%f",a,b,c)!EOF) { p=(a+b+c)/2; s=sqrt(p*(p-a)*(p-b)*(p-c)); printf("%f",s); } } /* Main.c: In function 'main': Main.c:5:18: warning: format '%f' expects argument of type 'float *', but argument 2 has type 'double' [-Wformat=] while(scanf("%f%f%f",a,b,c)!EOF) ~^ ~ Main.c:5:20: warning: format '%f' expects argument of type 'float *', but argument 3 has type 'double' [-Wformat=] while(scanf("%f%f%f",a,b,c)!EOF) ~^ ~ Main.c:5:22: warning: format '%f' expects argument of type 'float *', but argument 4 has type 'double' [-Wformat=] while(scanf("%f%f%f",a,b,c)!EOF) ~^ ~ Main.c:5:31: error: expected ')' before '!' token while(scanf("%f%f%f",a,b,c)!EOF) ~ ^ ) Main.c:7:7: warning: implicit declaration of function 'sqrt' [-Wimplicit-function-declaration] s=sqrt(p*(p-a)*(p-b)*(p-c)); ^~~~ Main.c:7:7: warning: incompatible implicit declaration of built-in function 'sqrt' Main.c:7:7: note: include '<math.h>' or provide a declaration of 'sqrt' Main.c:2:1: +#include <math.h> int main() Main.c:7:7: s=sqrt(p*(p-a)*(p-b)*(p-c)); ^~~~ */ |
Double click to view unformatted code.