fork download
  1. //Jacklyn Isordia CSC5 Chapter 3, P. 144, #10
  2. //
  3. /**************************************************************
  4.  *
  5.  * Convert Celsius to Fahrenheit
  6.  * ____________________________________________________________
  7.  * This program converts a temperature from Celsius to Fahrenheit
  8.  * using the formula:
  9.  *
  10.  * F = (9/5)c + 32
  11.  *
  12.  * ____________________________________________________________
  13.  * INPUT
  14.  * celsius : temperature in Celsius
  15.  *
  16.  * OUTPUT
  17.  * fahrenheit : temperatur converted to Fahrenheit
  18.  *
  19.  **************************************************************/
  20. #include <iostream>
  21. using namespace std;
  22.  
  23. int main()
  24. {
  25. float celsius;
  26. float fahrenheit;
  27.  
  28. //
  29. // Input Value
  30. //
  31. cout << "Enter temperature in Celsius: " << endl;
  32. cin >> celsius;
  33.  
  34. //
  35. // Compute Fahrenheit Temperature
  36. //
  37. fahrenheit = (9.0/5.0) * celsius + 32;
  38.  
  39. //
  40. // Output Result
  41. //
  42. cout << "The temperature in Fahrenheit is "
  43. << fahrenheit << endl;
  44.  
  45. return 0;
  46. }
Success #stdin #stdout 0.01s 5252KB
stdin
25
stdout
Enter temperature in Celsius: 
The temperature in Fahrenheit is 77