scampbell7
Programmer
I'm trying to take 2 values and compare them for eqaulity. I have a while loop for Fahrenheit temp's and I need to convert them to Celsius to see which temp is the same fo both. I did the formula out long hand and the answer is -40, now I just have to find a way to make the computer do it too!
here's the horrible mess I've made so far:
double tempF=0; //fahrenheit
float tempC=0; //Celsius
float counter = -100; //initiates count at -100 and gooes to +100
while(counter <= 100) {
tempF = counter; //stores each iteration of counter in tempF
tempC = (float)((5.0/9.0) * (tempF -32.0)); //converts Fahrenheit to Celsius
counter++;
}//ends while loop
if (tempC==(tempF)){
System.out.println("both Celsius and Farenheit have a common temperature at: " + ?????);
}//ends if
here's the horrible mess I've made so far:
double tempF=0; //fahrenheit
float tempC=0; //Celsius
float counter = -100; //initiates count at -100 and gooes to +100
while(counter <= 100) {
tempF = counter; //stores each iteration of counter in tempF
tempC = (float)((5.0/9.0) * (tempF -32.0)); //converts Fahrenheit to Celsius
counter++;
}//ends while loop
if (tempC==(tempF)){
System.out.println("both Celsius and Farenheit have a common temperature at: " + ?????);
}//ends if