# Help with homework trying to convert temperatures using functions

Page 1 of 1

## 2 Replies - 382 Views - Last Post: 28 February 2018 - 08:25 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=392279&amp;s=db7bfd198c3aea6e3f9b34812ba49624&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 azerega

Reputation: 0
• Posts: 3
• Joined: 15-April 16

# Help with homework trying to convert temperatures using functions

Posted 21 April 2016 - 10:17 AM

Hello everyone, I'm wondering if anyone could help me out with my code to make it work like I want to in order to complete the assignment? Attached is the instructions for the homework:
Write the code using functions.
Write a program that gives user menu to choose from –
1. Convert temperature input from the user in degrees Fahrenheit to degrees Celsius
2. Convert temperature input from the user in degrees Celsius to degrees Fahrenheit
3. Quit.
Formulae- C = (5 / 9) * (F-32) and F = (9/5) * C + 32
Need to use functions only to accomplish 1 and 2.
Need to use at least two functions for each scenario and need to call them from the main function. Can use
more functions as you see fit.
Test the program with the following values:
68 degree F = 20 degree C
20 degree C = 68 degree F
-22 degree F = -30 degree C
0 degree C = 32 degree F

Here is my code so far, I'm trying to just convert Fahrenheit to Celsius but it's not working:
```// Alejandro Zerega
// April 21, 2016
// Assignment 9

// Preprocessor Directives
#include <stdio.h>
#include <stdlib.h>
#define PAUSE system("pause")

// Prototype & Function Definitions
double farenheitToCelsius(double f, double celsius);
main() {
printf("1. Farenheit to Celsius\n");
printf("2. Celsius to Farenheit\n");
printf("3. Quit.\n");
double farenheit;
farenheitToCelsius(double f, double celsius);

PAUSE;
}

double farenheitToCelsius( double f, double celsius) {
double number, celsius;
printf("Please input the Farenheit temperature to convert to Celsius\n");
scanf_s("%lf", &number);
celsius = (5.0 / 9.0) * (number - 32.0);
printf("The equivalent temperature of %.2lf degrees Farenheit is %.2lf degrees Celsius\n", number, celsius);
return celsius;
}

```

Is This A Good Question/Topic? 0

## Replies To: Help with homework trying to convert temperatures using functions

### #2 modi123_1

• Suitor #2

Reputation: 13848
• Posts: 55,283
• Joined: 12-June 08

## Re: Help with homework trying to convert temperatures using functions

Posted 21 April 2016 - 10:20 AM

In what way is it not working?

### #3 femrost

Reputation: 0
• Posts: 5
• Joined: 09-January 18

## Re: Help with homework trying to convert temperatures using functions

Posted 28 February 2018 - 08:25 PM

[ rules ][ /rules ]