C program to input any string and count total char in it.
#include<stdio.h>
#include<conio.h>
void main( )
{
char str[20]; int i, c=0;
clrscr( );
printf("enter any string ");
scanf("%s",str);
i=0;
while(str[i]!='\0')
{
if(str[i]>=65 && str[i]<=90 || str[i]>=97 && str[i]<=122)
{
c=c+1;
}
i=i+1;
}
printf("Total char is %d\n",c);
getch( );
}
0 Comments