Extra 5% OFF Use Code: OL05
Free Shipping over ₹999

Find character and variable using array

#include<stdio.h>
void main()
{
    char a[20],i,n;
    printf("Enter the number of element (array length less then 20!):");
    scanf("%d",&n);
    printf("Enter numbers and characters:");
    for(i = 0; i < n; i++)
    {
        //insert numbers and characters in array
        scanf("\n%c",&a[i]);
    }
    for( i = 0; i < n; i++)
    {
        //find the characters from array
        if(a[i]>='a' && a[i]<='z' || a[i]>='A' && a[i]<='Z')
        {
            printf("\n%c = is character !",a[i]);
        }
        else
        {
            if(a[i]>0)
                printf("\n%c = is number !",a[i]);
        }
    }

}

    Leave a Reply

    Your email address will not be published.

    Need Help?