Converting Fahrenheit-Celsius & Vice-Versa

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
clarence_cool03 clarence_cool03 is offline Offline May 15th, 2009, 12:51 am |
0
{-='Converting Fahrenheit-Celsius & Vice-Versa using Dev-C LaNGuaGe'=-}
Quick reply to this message  
C Syntax
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. // Local Declarations
  6. float Celsius, Fahrenheit, Fahrenheit_1, Celsius_2;
  7.  
  8. // Statements
  9. printf("Enter the temperature in Fahrenheit: ");
  10. scanf("%f", &Fahrenheit);
  11. printf("Fahrenheit temperature is: %5.1f F\n\a", Fahrenheit);
  12.  
  13. Celsius = (100.0 / 180.0) * (Fahrenheit - 32);
  14.  
  15. printf("Celsius temperature is: %8.1f C\n\n\a", Celsius);
  16.  
  17. system("pause");
  18. system("cls");
  19.  
  20. printf("Enter the temperature in Celsius: ");
  21. scanf("%f", &Celsius_2);
  22. printf("Celsius temperature is: %8.1f C\n\a", Celsius_2);
  23.  
  24. Fahrenheit_1 = 32 + (Celsius_2 * (180.0 / 100.0));
  25.  
  26. printf("Fahrenheit temperature is: %5.1f F\a", Fahrenheit_1);
  27.  
  28. system("pause");
  29. return 0;
  30. }// main

Message:


Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC