Count the no of lowercase letters in a text file bca.txt in C
Write a program in C to count the no of lowercase letters in a text file bca.txt This program reads one character at a time by using fgetc() function until the EOF (end of file) returns. Then it checks whether the current character is lowercase or not. If it is a lowercase letter it increments the value of c by 1. It also displays the contents of file named bca.txt. And finally print the total number of lowercase letters present in the file, which is the main purpose to write the program Program #include<stdio.h> #include<conio.h> void main() { FILE *fptr; char ch; int c=0; if((fptr=fopen("bca.txt","r"))==NULL) printf("File doesn't exist\n"); else { while((ch=fgetc(fptr))!=EOF) { if(ch>=97&&ch<=122) c++; printf("%c",ch); } } printf("\nTotal lowercase letter in bca.txt file ...