Program to Count Blanks Spaces ,Tabs and Newlines in Given String In C



#include

int main(void)
{
int nb,nt,nl,c;
nb=nt=nl=0;

while((c=getchar())!=EOF)
{
if(c==' ')
++nb;
if(c==' ')
++nt;
if(c==' ')
++nl;
}

printf("No. of Blanks is %d,No. of Tabs is %d and No. of Newlines is %d",nb,nt,nl);

return 0;
}


No comments:

Post a Comment