Have an error! Could someone pls? && Does it really need of fabs (). | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Have an error! Could someone pls? && Does it really need of fabs ().

#include <stdio.h> int main() float true_val,approx_val; float ea,er,ep; //input: Enter true value & approximate value //scanf("%f",&true_val); //input: Enter approximate value //scanf("%f",&approx_val); scanf("%f%f",&true_val&approx_val); ea=fabs(true_val - approxx_val ); er=ea/true_val; ep=er*100; printf("\n Absolute Error is : ",ea); printf("\n Relative Error is : ",er); printf("\n Precentage Error is : ",ep); return 0; }

10th Oct 2018, 9:09 AM
<Saurabh Singh Rawat/>
<Saurabh Singh Rawat/> - avatar
4 Answers
+ 3
{ missing after int main () Line 14: separate &true_val and &approx_val with a comma Line 15: use same spelling for your variables all the way through Line 18-20: format specifiers missing (%.2f etc.)
10th Oct 2018, 9:16 AM
Anna
Anna - avatar
+ 2
missing math.h include in addition of errors mentioned by Anna
10th Oct 2018, 9:59 AM
Xavier Heugue
Xavier Heugue - avatar
0
puh! sometimes 😀😀 well gracious sirs. thanks a lot I been wondering for this like an idiot. 😊😊
10th Oct 2018, 10:03 AM
<Saurabh Singh Rawat/>
<Saurabh Singh Rawat/> - avatar
0
if I run this program after debugging, it only ask for input once. But it should ask twice coz there are two inputs required.
10th Oct 2018, 11:42 AM
<Saurabh Singh Rawat/>
<Saurabh Singh Rawat/> - avatar