Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need a program (in C programming language) that should read \".txt\" file and

ID: 3797288 • Letter: I

Question

I need a program (in C programming language) that should read ".txt" file and count how many lower case in the file but it should count one by one (calculate probabilities of all letters) and write to screen) all of results. For example, p(a) = 0.123, p(b)=0.053 etc. Additionally, this program should calculate p(aa), p(bb) and p(a|b) possibilities [Joint and Conditional probabilities] and lastly, the program should calculate all entropies for each possibilities and write to screen all of results.

Explanation / Answer

#include<stdio.h>

int main() {

   int upper = 0, lower = 0;

   char ch[80];

   int i;

   printf(" Enter The String : ");

   gets(ch);

   i = 0;

   while (ch[i] != '') {

      if (ch[i] >= 'A' && ch[i] <= 'Z')

         upper++;

      if (ch[i] >= 'a' && ch[i] <= 'z')

         lower++;

      i++;

   }

   printf(" Uppercase Letters : %d", upper);

   printf(" Lowercase Letters : %d", lower);

   return (0);

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote