# Print the value of a function

**URL:** https://discourse.processing.org/t/print-the-value-of-a-function/1902
**Category:** Beginners
**Created:** [July 19, 2018, 1:06pm UTC](https://discourse.processing.org/t/print-the-value-of-a-function/1902 "2018-07-19T13:06:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Javier](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/javier/32/817_2.png) [@Javier](https://discourse.processing.org/u/Javier)
#### Post date: [July 19, 2018, 1:06pm UTC](https://discourse.processing.org/t/print-the-value-of-a-function/1902/1 "2018-07-19T13:06:03Z")

</div>

Hi all¡¡ I have defined a very simple function that transfer fahrenheit to celsius and I want to introduce as a variable the Fharenheit and return Celsius. I would like to print the value of the Celsius but i cant undestand why i get 0 value…does someone knows where is the error? Thanks in advanced¡¡

float tempConverter(float F) {  
float C=(F-32)\*(5/9);  
return C;  
}

void draw() {  
float t=tempConverter(500);  
println(t);  
}

Thank you¡

---

<div class="post-metadata">

### Author: ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)
#### Post date: [July 19, 2018, 1:09pm UTC](https://discourse.processing.org/t/print-the-value-of-a-function/1902/2 "2018-07-19T13:09:31Z")

</div>

Hi,

Try with 32.0, 5.0 and 9.0

I think you need to be sure that all your values are float numbers. Without .0 they are consider as int and thus you have troubles with your divisions.

---

<div class="post-metadata">

### Author: ![Javier](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/javier/32/817_2.png) [@Javier](https://discourse.processing.org/u/Javier)
#### Post date: [July 19, 2018, 4:26pm UTC](https://discourse.processing.org/t/print-the-value-of-a-function/1902/3 "2018-07-19T16:26:21Z")

</div>

Thanks a lot @jb4x i was getting mad cause I didn’t find the error. Thanks

---

<div class="post-metadata">

### Author: ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)
#### Post date: [July 19, 2018, 4:59pm UTC](https://discourse.processing.org/t/print-the-value-of-a-function/1902/4 "2018-07-19T16:59:25Z")

</div>

With pleasure 🙂

When you are not use to it, it can be very, very annoying !
