title: Fahrenheit to Celsius program improvement and choosing the output
body: <p>I just started programming in C a few days ago and I want to improve my program but not sure how to do it.</p>
  
  <p>This program is a Fahrenheit to Celsius and vice versa converter. I did it in the simplest way possible. But now I want to do it so that I have 2 functions c2f and f2c which take the temperature as a parameter and when I run the program I want do choose whether I want to covert from F to C or from C to F (something like TempConverter -f 32 this should only convert 32 into celsius and TempConverter -c 100 should covert 100 into Fahrenheit).</p>
  
  <p>I think my functions should be something like this : <strong>float c2f (float c)</strong> and <strong>float f2c (float f)</strong> </p>
  
  <p>But how exactly do it do it so when I run something like <strong>> TempConverter -f 50.0</strong> I get something like this let's say?
  <strong>10.00°C = 50.00°F</strong></p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
  int main(void)
  {
      // Local Declarations
      float Celsius, Fahrenheit, Fahrenheit_1, Celsius_2;
  
      // Statements
      printf("Enter the temperature in Fahrenheit: ");
      scanf("%f", &amp;Fahrenheit);
      printf("Fahrenheit temperature is: %5.1f F\n\a", Fahrenheit);
  
      Celsius = (100.0 / 180.0) * (Fahrenheit - 32);
  
      printf("Celsius temperature is: %8.1f C\n\n\a", Celsius);
  
      printf("Enter the temperature in Celsius: ");
      scanf("%f", &amp;Celsius_2);
      printf("Celsius temperature is: %8.1f C\n\a", Celsius_2);
  
      Fahrenheit_1 = 32 + (Celsius_2 * (180.0 / 100.0));
  
      printf("Fahrenheit temperature is: %5.1f F\a", Fahrenheit_1);
  
      return 0;
  
  }
  </code></pre>
  
  <p><strong>Current output:</strong></p>
  
  <p>*Enter the temperature in Fahrenheit: 20</p>
  
  <p>Fahrenheit temperature is:  20.0 F</p>
  
  <p>Celsius temperature is:     -6.7 C</p>
  
  <p>Enter the temperature in Celsius: 40</p>
  
  <p>Celsius temperature is:     40.0 C</p>
  
  <p>Fahrenheit temperature is: 104.0 F*</p>
  
  <p><strong>Desired Output</strong></p>
  
  <blockquote>
    <p>TempConverter -f 50.0</p>
  </blockquote>
  
  <p>10.00°C = 50.00°F</p>