Write a program to check if given character is digit or not.

//program to check if given character is digit or not. 

#include<stdio.h>

#include<math.h>


int main()


{

int x;

printf("enter digit");

scanf("%d", x>=0 && x<=9);

return 0;

}


It will return non-zero numbers if the user enters digit (0-9) and returns zero for others.

Comments

Popular posts from this blog

Write a program to check if a number is prime or not.

write a program (keep taking numbers as input from user until user enters an Odd number)

write a program to print all the odd numbers from 1 to 100.