Program to check given character is digit or not without using loop

 Program to check given character is digit or not without using loop

// WAP to check whether given character is digit
// or not
//Step:1 First take input from the user as character datatype
//step2:Now use if statement to check your character is lie between 0 to 9 or not
//if the condition is true then print Digit
//Step4: Otherwise use else Statement to print not digit

#include<stdio.h>

main()
{
    char c;
    printf("Enter the character :");
    scanf("%c",&c);
    if(c>='0' && c<='9')
    {
        printf("Given character is digit.");
     }
    else{
        printf("Not digit.");
    }
   
}
  
           
           
      
   

No comments:

Powered by Blogger.