1 solutions

  • 0
    @ 2025-11-5 16:59:36

    C :

    #include <stdio.h>
    #include <math.h>
    #include <stdlib.h>
    #include <time.h>
    int main()
    {
     //   freopen("in","r",stdin);
    //    freopen("out","w",stdout);
    
    	char  ch;
        while(scanf("%c", &ch)!=EOF)
        {
    
         getchar();
    
    	if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))
    	{
    		printf("It is an English character!\n");
    	}
    	else if (ch <= '9' && ch >= '0')
    	{
    	    	printf("It is a digit character!\n");
    	}
    	else if (ch == ' ')
    	{
    	    	printf("It is a space character!\n");
    	}
    	else
    	{
    		printf("It is other character!\n");
    	}
    
    
    
    
        }
      return 0;
    }
    
    

    C++ :

    #include<cstdio>
    int main()
    {
    	char ch;
    	while (scanf("%c", &ch) != EOF)
    	{
    		if (ch >= '0'&&ch <= '9')
    			printf("It is a digit character!\n");
    		else if ((ch >= 'A'&&ch <= 'Z') || (ch >= 'a'&&ch <= 'z'))
    			printf("It is an English character!\n");
    		else if (ch == ' ')
    			printf("It is a space character!\n");
    		else
    			printf("It is other character!\n");
    		getchar();
    	}
    	
    }
    
    • 1

    Information

    ID
    18123
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By