# Getting Error: Called Object is not a Function

• 06-22-2010
Ketsueki
Getting Error: Called Object is not a Function
Hello All,

This is just a simple programming challenging from a book I'm using to learn C, it doesn't call for the if/else statement but I wanted to add it. I have used if/else before successfully, but for some reason now on the else portion it wont do the calculation. At first I thought celsius was a reserved word and thats why it was failing, but so I changed the variables name but still same error.

Code:

```#include <stdio.h> int main(void) {     int Choice; /* stores users choice on conversion */     double fahrenheit; /* stores the temp in Fahrenheit */     double centigrade; /* stores the temp in Celsius */       /* Asks the user what they want to convert. */     printf("Please choose how you want to convert\n");     printf("Press 1 for Celsius to Fahrenheit\n");     printf("Press 2 for Fahrenheit to Celsius: ");     scanf("%d", &Choice);     /*Determines what the user chooses */     if (Choice == 1)     {         /* Obtains the temp and converts to fahrenheit */         printf("\nPlease enter in the Temp in degree's Celsius: ");         scanf("%lf", &centigrade);         fahrenheit = (9/5 * centigrade)+32;         printf("\n %.2f Celsius is %.2f Fahrenheit\n ", centigrade, fahrenheit);     }     else     {         /* Obtains the temp and converts to Celsius */         printf("\nPlease enter in the Temp in degree's Fahrenheit: ");         scanf("%lf", &fahrenheit);         centigrade = (5/9)(fahrenheit - 32);         printf("\n %.2f Fahrenheit is %.2f Celsius\n", fahrenheit, centigrade);             }               return(0); }```
when compiled I get this error ConvertTemp.c:40: error: called object is not a function and line 40 is centigrade = (5/9)(fahrenheit -32); but the equation in the if statement runs fine, and if I take else out completely it runs fine. I read around about people with similar errors, and tried to use the fixes they had but most were when they were actually calling a function aside from stdio.h I'm not calling any others. Thanks in advance.
• 06-22-2010
Bayint Naung
Code:

`        centigrade = (5/9)(fahrenheit - 32);`
Simple, You forgot * multiplication operator! :D
Wait, 5/9 will evaluate to zero! Use 5.0/9.0.
c-faq
• 06-22-2010
Ketsueki
Thanks so much, I was thinking that ()() would be multiplication like in algebra. I will make a note of that in the future, always have to use the operators.
• 06-23-2010
Elysia