Monday, May 24, 2010

Computer programing Help?

I am trying to use quincy to run this program, but It won't work. I have a runtime error, I can't find it. Can anyone assit me? Thank you!





#include %26lt;stdio.h%26gt;





inx


main (void)


{


int a = 3; b = 4, e;


Double f = 4, c, d;





d = a + b;


c = a / (f - b);


printf (The value of d is %d"\n, d)


return (0);


}

Computer programing Help?
You're trying to display a 'double' value with the specifier '%d'.. meant for integers. Use the specifier '%lf' for double values.


So, change your code from


printf (The value of d is %d"\n, d)


to


printf (The value of d is %lf"\n, d)


That'll probably help.
Reply:b = 4 and f = 4





so, a / (f - b) -%26gt; a / 0





its a divide-by-zero error
Reply:printf("The value of d is %d\n",d);


getch();


return 0;

narcissus

No comments:

Post a Comment