Skip to content

Instantly share code, notes, and snippets.

@shohan4556
Created September 19, 2014 02:40
Show Gist options
  • Save shohan4556/5a3a1227bffa7d6fd322 to your computer and use it in GitHub Desktop.
Save shohan4556/5a3a1227bffa7d6fd322 to your computer and use it in GitHub Desktop.
letter counter
#include<stdio.h>
int main()
{
char str[100];
int i=0,nl=0;
gets(str); // it takes input with space
while(str[i] !='\0') // null termination character, it marks the the end of string
{
char ch= str[i];
if (ch>= 'A' && ch<= 'Z' || ch>= 'a' && ch<= 'z')
nl++;
i++;
}
printf("Letter : %d\n",nl);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment