fork download
  1. //Cecilia Rangel CSC5 Chapter 3, P. 144, #10
  2. //
  3. /**************************************************************
  4.  *
  5.  * Converting Celsius to Fahrenheit
  6.  * ____________________________________________________________
  7.  * This program converts celsius to fahrenheiht
  8.  *
  9.  * Calculation is based on this Formula:
  10.  * F = 9/5C +32
  11.  *___________________________________________________________
  12.  * INPUT
  13.  * celsius : user input
  14.  *
  15.  * OUTPUT
  16.  * Fahrenheit : from calculations
  17.  *
  18.  **************************************************************/
  19. #include <iostream>
  20. using namespace std;
  21.  
  22. int main() {
  23. float celsius;
  24. float fahrenheit;
  25.  
  26. cout << "Enter degrees in Celsius to convert to Fahrenheit." << endl;
  27. cin >> celsius;
  28.  
  29. fahrenheit = celsius * 9/5 + 32;
  30.  
  31. cout << celsius << " degress Celsius is " << fahrenheit
  32. << " degrees Fahrenheit.";
  33. return 0;
  34. }
Success #stdin #stdout 0.01s 5284KB
stdin
20
stdout
Enter degrees in Celsius to convert to Fahrenheit.
20 degress Celsius is 68 degrees Fahrenheit.