Design a program that displays a table of the Celsius temperatures 0 through 20 and their Fahrenheit equivalents. The formula for converting a temperature from Celsius to Fahrenheit is:
F = 9/5 C + 32
where F is the Fahrenheit temperature and C is the Celsius temperature. Your program must use a loop to display the table.
Follow Us on Instagram and Join Telegram for more updates and queries:
Answer:
CODE:
//Visit Sikshapath.in for more #include <iostream> #include <iomanip> using namespace std; int main() { float f = 0; cout << setprecision(1) << fixed; //sets 1 decimal place (fixed makes it decimals instead of digits) cout << "Celsius\t\tFahrenheit" << endl; for( int i = 0; i <= 20; i += 1 ) { f=(i*1.8)+32; cout << i << "\t\t" << f << endl; } return 0; }