#include <stdio.h> void main(void) { float value; int int_test(float); printf("Your Number: "); scanf("%f", &value); while (value !=0) { int_test(value); printf("Your Number: "); scanf("%f", &value); } } int int_test(float a) { int result; if (a<0) { printf("The number you have entered is negative\n"); result = -1; return result; } else if ((a>0) && (int)(a-a>0)) { printf("The number you have entered is not an integer\n"); result = 0; return 0; } else { printf("The number you have entered is %g\n",a); return a; } }
(int)(a-a>0)
((a-(int)a)>0)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)