In the below code im getting a year from the user. but when I print of the year from scanf is doesnt print the correct value such as 2010 will be printed as 74.43434 (somthing like this).
If i change the scanf from %.3lf to %f or %d the program will crash.
ANY IDEAS ANYONE?
double year;
if (r <=-.9){
printf("Data are linearly correlated: r = %1.3f\n",r);
printf("What year do you want to predict? ");
scanf( "%.3lf",year);
predict = meany + b*year;
printf("Predicted index in year %.3lf is %lf", year, predict);
}
else
printf("Data are not linearly correlated: r = %lf\n",r);
printf("Stopping");