Hello,
Need to make it so that if a RATIONAL number is entered it returns 1 and if a letter/nothing is entered it returns 0. Before, I used "int" and %d and the program worked perfectly for integers, but now I need it to also work with numbers that have decimals... I tried changing the %d to %f and int to double but it didn't work..
Thanks
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <stdio.h>
int main(void)
{
double x1, y1
printf("Enter point #1:\n");
if (scanf("%f%f", &x1,&y1)==2)
{
return 1;
}
else
{
printf("Invalid Entry.\n");
return 0;
}