090. Write a program to count no, of alphlabets, digits, special symbols in C language

 
#include<stdio.h>
#include<conio.h>
main()
{
	int i,alphabets=0,digits=0,symbols=0;
	char *s;
	clrscr();
	printf("Enter the string 1....");
	scanf("%s",s);
 
	for(i=0;s[i]!='\0';i++)
	{
		 if(((s[i]>='A')&&(s[i]<='Z'))||((s[i]>='a')&&(s[i]<='z')))
				alphabets++;
		 else if((s[i]>='0')&&(s[i]<='9'))
				digits++;
		 else
				symbols++;
	}
	printf("\nAlphabets : %d",alphabets);
	printf("\nDigits    : %d",digits);
	printf("\nSymbols   : %d",symbols);
	getch();
}

3 thoughts on “090. Write a program to count no, of alphlabets, digits, special symbols in C language

  1. Hi! can you please explain this part “s[i]!=””. I can’t understand what not equal to ” actually means. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *