double low = 0 , high = 0.0,n = 0.0;
----
printf("Enter the integral limits (low high): ");
scanf("%lf %lf", &low, &high);
printf("%lf%lf",low,high);
printf("Enter the number of subinternals (n): ");
scanf("%lf",&n);
When I test this program (by
printf("%lf%lf",low,high);) (6th line)
I get values of 0.000000 and 0.000000 for low and high. I initialized them at the beginning of the program and now I'm trying to input values for them.
What am I doing wrong?
{P.S. I'm on a windows 7 laptop. and I've already tried changing the "%f" to "%lf" and back to "%f")
What should I do? (HELP PLEASE!)
EDIT: I'm not sure what just happened. I error checked with
if (2 != scanf("%lf %lf", &low, &high))
printf("scanf failed!\n")
and what happened instead was that after my "..(low high): " I entered 1 and 2, and then the program was waiting for more input, and then I entered 1 and 2 again, and this time, it gave the right prinft... not sure what happened?
Output screen: http://s1288.photobucket.com/user/Kdragonflys/media/ss_zps6b85396e.png.html