This is my code:
#include<stdio.h>
#include<math.h>
int fruitloops(int n)
{
if(n%2==0)
{
printf("The number is even.\n");
}
else
{
printf("The number is odd.\n");
}
}
int main()
{
int n;
printf("Enter any number you want to check the parity of: \n");
scanf("%d",&n);
if(n==floor(n))
{
fruitloops(n);
}
else if(n!=floor(n))
{
for(int i=0;i<10;i++)
{
printf("Enter an integer, not any random number: \n");
scanf("%d",&n);
if(n=floor(n))
{
fruitloops(n);
break;
}
else
{
continue;
}
i++;
}
}
return 0;
}
It takes in my input but doesn't give me a correct answer and i can't seem to find out where i went wrong for example when i put in 10.5 i get even as the output but it seems to work fine when i use an integer