KodeGod.com

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();
}