#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();
}
- #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();
- }
#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();
}
Hi! can you please explain this part “s[i]!=””. I can’t understand what not equal to ” actually means. Thanks!
My bad! i get it now. it means null. Thanks for the source, by the way.
We are checking for end of string over there.