0
#include <stdio.h>

#include    <ctype.h>
int main()
{
    double number= 0.0;
    n1:
    printf(" Your number:");
    scanf("%lf",&number);
    getchar();
    if(!isdigit(number))
    {
       printf("not a number, please only numbers\n");
       goto n1;
    }
    else
    {
       printf("is a number");
    }
    return 0;

}

why doesnt this work? where did I make a mistake here ? Is the function isdigit() used correctly?

Barmar
  • 741,623
  • 53
  • 500
  • 612

0 Answers0