KodeGod.com

082. Write a program to accept a string and print no. of aphlabets, digits, special symbols present in it in C language

#include<stdio.h>
#include<conio.h>  
#include<ctype.h>
main()
{
	char *s;
	int i,alphabets=0,digits=0,symbols=0;
	clrscr();
	printf("Enter string : ");
	scanf("%s",s);
	for(i=0;s[i]!='\0';i++)

		if(isalpha(s[i]))
			alphabets++;
		else if(isdigit(s[i]))
			digits++;
		else
			symbols++;

	printf("\nAphabets : %d",alphabets);
	printf("\nDigits   : %d",digits);
	printf("\nSymbols  : %d",symbols);
	getch();
}