ok so im in CS50AP which means for you who dont know mean im in high school so i could use some help with this right now my code for fahrenheit is:

#include <cs50.h>
#include <stdio.h>

int main(void)
      printf("What is the temperature in Celsius to whole degree: ");
      float tempc = GetFloat ();

      float tempf = GetFloat ((("%.1f" * 9) / 5) + 32, tempc);

      printf("your new temperature in Fahrenheit %.1f\n", tempf);


and im getting error that dont make sence to me

c2f.c:9:36: error: invalid operands to binary expression ('char *' and 'int')
  float tempf = GetFloat ((("%.1f" * 9) / 5) + 32, tempc);

any ideas bc im lost


The GetFloat() function takes no input, so you should not perform arithmetic on it as that results in errors like the one you are seeing.

If you want to output the converted value as a float, you must declare a float -- which you are already doing in float tempf -- then you should then convert it to fahrenheit by assigning it the expression that converts celsius to fahrenheit. Like float tempf = EXPRESSION;, remember to drop the %.1f and , tempc part though, because these are part of a printf call which should be on the next line.

Feel free to comment back if you have any additional questions, good luck!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .