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

program to (keep taking number as input from user until user enters a number which is multiple of 5.)

write a program to print the numbers from 0 to n, if n is given by user.

Write a program to print the average of 3 numbers.