and it is not running successfully... abnormal trmination
how to handle floating point error
Collapse
X
-
Tags: None
-
Code:#include<stdio.h> #include<conio.h> void main() { float a[4],b[4],c[4]; int i; float sum12,sum13,sum23,d12,d23,d13; clrscr(); printf("enter 3 digits wd 4 boundries\n"); for(i=0;i<4;i++) { scanf("%f",&a[i]); scanf("%f",&b[i]); scanf("%f",&c[i]); } d12=(1.0/4.0) * (fabs(a[0]-b[0])+fabs(a[1]-b[1])+fabs(a[2]-b[2])+ fabs(a[3]-b[3])); d13=(1.0/4.0) * (fabs(a[0]-c[0])+fabs(a[1]-c[1])+fabs(a[2]-c[2])+ fabs(a[3]-c[3])); d23=(1.0/4.0) * (fabs(b[0]-c[0])+fabs(b[1]-c[1])+fabs(b[2]-c[2])+ fabs(b[3]-c[3])); printf("distance btwn 1 & 2=%f\n",d12); printf("distance btwn 1 & 3=%f\n",d13); printf("distance btwn 2 & 3=%f\n",d23); getch(); } -
-
Please tell us the symptoms. In what way is the program not running successfully?- Compiler/linker error. Tell us the error.
- Run-time error. Tell us the error.
- Incorrect answer. What answer did you get; what did you expect?
We cannot look for discrepancies between what your program actually does and what you intend it to do if you don't tell us what the program is supposed to do.Comment
Comment