Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

07-08 Fahrenheit #211

Open
TKerem opened this issue Jul 2, 2017 · 5 comments
Open

07-08 Fahrenheit #211

TKerem opened this issue Jul 2, 2017 · 5 comments

Comments

@TKerem
Copy link

TKerem commented Jul 2, 2017

I can't understand the Exercise 7-8

Please help me to find the solution.

This is my code, but the result is always 0.0

void setup (){
size(200,200);
}

void draw () {
float result = convertToCelsius(100);
println(result);
}

float convertToCelsius(float F){
float c = (F - 32) * (5/9);
return c;
}

@itubal
Copy link

itubal commented Jul 3, 2017

Try with all numbers floats.

100.0, 32.0, 5.0, 9.0
May be the error.
Try to "debug" your program. Print the F in the beginin of convertToCelsius() (before float c...), print c after this line.
Ah! don't put variables in uppercase.

@TKerem
Copy link
Author

TKerem commented Jul 3, 2017

The skect doesn't work. I try a lot of numbers but I don't understand where is the problem.

@itubal
Copy link

itubal commented Jul 3, 2017 via email

@ghost
Copy link

ghost commented Jul 22, 2017

I have the answer here:

void draw(){
float answer = tempConverter(46);
println(answer);
}

float tempConverter(float f){
float c = (f - 32.0)*(5.0/9.0);
return c;
}


the float values must have decimals so they can be read properly.

:)

@TKerem
Copy link
Author

TKerem commented Jul 23, 2017

Thanks !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants