So I'm trying to make a simple temperature converter. All looks fine to me but I don't know why the scan input is not being recognised. Thanks for your time.
#include <stdio.h>
exercise1(){
float a;
char tem;
printf("--- Temperature Converter ---\n");
printf("Please enter a temperature: ");
scanf("%f", &a);
printf("\nWould you like to convert to Celsius or Fahrenheit? (c or f)");
scanf("%c", &tem); getchar();
if (tem == 'c'){
a = ((float)a-32) * 5.0f/9.0f;
printf("\nYour temperature is %g\n", &a);
}
else if (tem == 'f'){
a = (float)a * 9.0f/5.0f + 32;
printf("\nYour temperature is %g\n", &a);
}
else
printf("\nPlease enter a valid conversion type!\n");
}
}