/*#include <stdio.h> 
int main(void)
{  int hit = 0;
    const int chance = 10;
   hit = 3;
   double hitting_rate = hit / chance ;
   printf("타율은: %.3lf입니다.\n", hitting_rate);
    
    return 0;
    
}
*/

// 타율은: 0.300입니다. 이걸 노렸지만 저렇게 하니 오류뜸. 
//제미나이: 정수(int)끼리 나누면 소수가 나올 수 없음. 무조건 정수로 나옴. 정수타입은 소수점을 버리고 출력됨
// 최소한 한 쪽을 실수로 바꿔줘라.

#include <stdio.h> 
int main(void)
{  double  hit = 0;
    const int chance = 10;
   hit = 3;
   double hitting_rate = hit / chance ;
   printf("타율은: %.3lf입니다.\n", hitting_rate);
    
    return 0; 
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: