Accept a character as input and check whether the character is a digit.( Check if it is in the range 0 to 9 both inclusive)
#include<stdio.h> void main() { int i=0,flag=0,num; printf("\nEnter the Number between(0 to 9) : "); scanf("%d",&num); if(num<=9) { while(i<=9) { if(num==i) { flag=1; break; } else { i++; } } if(flag==1) { printf("\n It is Digit."); } else { printf("\n Not Digit."); } } else { printf("\n Number not between 0 to 9"); } getch(); }
Accept a character as input and check whether the character is a digit.( Check if it is in the range 0 to 9 both inclusive)
Reviewed by
on
August 30, 2019
Rating: