#include<stdio.h>
#include<conio.h>
void
main()
{
FILE *fp;
char ch;
int noc=0,now=0,nol=0,not=0;
clrscr();
fp=fopen("a.txt","r");
if(fp==NULL)
{
printf("\n unable to open file");
}
while((ch=fgetc(fp))!=EOF)
{
if(ch==EOF)
{
break;
}
noc++;
if(ch==' ')
{
now++;
}
if(ch=='\n')
{
nol++;
}
if(ch=='\t')
{
not++;
}
}
fclose(fp);
printf("\n the no of characters are
%d",noc);
printf("\n the no of words are
%d",now+nol);
printf("\n the no of lines are
%d",nol);
printf("\n the no of tabs are
%d",not);
getch();
}