I'm looking for the operator input to be differentiated from integer and float. Here is what I have so far (which doesn't seem to work)
#include<stdio.h>
#include<stdlib.h>
int num1, num2, num3;
int main (void)
{
printf("Input a number:");
scanf("%d",&num1);
num2=(num1)/2; /* outputs an integer number if float is entered */
num3=num2*2; /* should not equal num1 if float number was entered */
if (num3==num1)
printf("\nThis is an integer");
else
printf("\nThis is a float");
return 0;
}
Please someone tell me where I'm going wrong...I appreciate the help.