1) Remember that in C, all sentences end with a semicolon.
2) Also that the function scanf () that helps us request data through The keyboard has two arguments ( scanf("%codigoFormato", &nombreVariableQueAlmacenaLaEntrada);
) and not 3 as you are doing (the arguments that use the functions are separated by ","):
#include <stdio.h>
int main(){
int g_c //*ERROR 1)
int g_f = 32;
int mult = 0;
printf("Digite el numero de grados celsius: ");
scanf("%i",&g_c,); //*ERROR 2)
mult = g_c * g_f;
printf("La conversion es: %i",mult);
return 0;
}
3) Now the formula for converting from Celsius to Farenheit is:
°F = °C × 9/5 + 32
Therefore the input value must be multiplied by 9/5 and add the variable that has the value of 32 ( g_f
):
mult = (g_c * 9/5) + g_f;
Make these changes to make your program work correctly:
#include <stdio.h>
int main() {
int g_c;
int g_f = 32; //* 1)
int mult = 0;
printf("Digite el numero de grados celsius: ");
scanf("%i",&g_c); //* 2)
mult = (g_c * 9/5) + g_f; //* 3)
printf("La conversion es: %i",mult);
return 0;
}