Celsius to Fahrenheit in C++
Posted by Samath
Last Updated: December 25, 2014

Write a program that displays a table of temperatures from 0C to 20C and their Fahrenheit equivalents. The formula for converting from the Celsius scale to the Fahrenheit scale is F= (9/5) C + 32 where F is the temperature in Fahrenheit and C is the temperature in Celsius.

#include <iostream>
#include <cstdlib>
 
using namespace std;
 
int main(int argc, char *argv[])
{
	float fahrenheit,celcius;
	for(celcius=0;celcius<=20;celcius++)
    {
        fahrenheit = (celcius*9/5)+32;  
        cout<<celcius <<" Celcius: " << fahrenheit <<" Fahrenheit\n";
    }  
	return 0;
}