0
다음 프로그램을 컴파일 할 때 부동 소수점 오류가 불법적으로 사용됩니다. 내가 실수를 저지르고 있음을 알려주십시오.c의 부동 소수점을 사용하는 계수
#include<stdio.h>
#include<conio.h>
void main()
{
float a;
clrscr();
printf("\n Enter the num : ");
scanf("%f", &a);
if (a >= 0)
{
if ((a % 2) == 0) //ERROR HERE
{
printf("\n You entered a positive even num");
}
else
{
printf("\n You entered a positive odd num");
}
}
else
{
if ((a % 2) == 0) //ERROR HERE
{
printf("\n You entered a negative even num");
}
else
{
printf("\n You entered a negative odd num");
}
}
getch();
}
... "이상한/추측에 대한 추론을한다면 어쨌든 정수로 작업 할 것입니다."'a'를'int'로 변경하십시오. – Vlad
fmod() 함수에서 전달할 매개 변수는 무엇입니까? – rippy
@rippy : 이제 일부 문서에 대한 링크를 추가했습니다. –