Temperature conversion...
Hi, I'm new at C programming, and I'm following the HowStuffWorks.com C programming tutorial/guide until I get some books- it has nice examples and lets you experiment. Anyways, I'm working on a temperature conversion program- a basic loop project. I'm trying to convert Fahrenheit to Celcius with user-inputted starting temp, ending temp, and increment value. Problem is, IT KEEPS REPEATING. I've spent an hour trying to figure out why, but i can't find the cause of it all. So here's the code. Thanks
Code:
#include <stdio.h>
int main()
{
float a, b, c, d;
printf("Enter a value for the starting temperature in Fahrenheit:");
scanf("%f", b);
printf("Enter a value for the ending temperature in Fahrenheit:");
scanf("%f", c);
printf("Enter a value for the temperature increment value in Fahrenheit:");
scanf("%f", d);
a = b;
printf("This is a Fahrenheit to Celcius Conversion Table!");
while (a <= c)
{
if ((a > 98.6) && (a < (a + d)))
{
printf("%f degrees F = %f degrees C\n",
98.6, (98.6 - 32.0) * 5.0 / 9.0);
}
printf("%f degrees F = %f degrees C\n",
a, (a - 32.0) * 5.0 / 9.0);
a = (a + d);
}
return 0;
}