printf("ho_tari\n");
fahr2celsius 본문
#include <stdio.h>
int main(void)
{
int fahr;
int celsius;
fahr = 100;
//celsius = 5/9 * (fahr - 32);
//celsius = 5.0 / 9.0 * (fahr - 32);
celsius = (fahr - 32) * 5/9;
printf("fahr : %d ---> celsius : %d\n", fahr, celsius);
return 0;
}
<compile 결과>
<fahr2celsius2.c>
#include <stdio.h>
int main(void)
{
int fahr;
double celsius;
printf("Fahrenheit : ");
scanf("%d", &fahr);
celsius = 5.0 / 9.0 * (fahr - 32);
printf("Celsius : %.3f\n", celsius);
return 0;
}
<compile 결과>