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

Write a complete program using two arrays, upper and lower to keep the upper And

ID: 3538829 • Letter: W

Question

Write a complete program using two arrays, upper and lower to keep the upper

And lower alphabet respectively.

Ask the user to enter string example:

This is a test from Jupiter. Soon you will see who is from Jupiter!!! May be Dr. D.

Your program should parse the string and keep track of number of alphabet. Both arrays are indexed from 0 to 25. The logical way to do this is to use upper[0] to

Count the number of %u2018A%u2019, and upper[1] to count number of %u2018B%u2019 and so on. Likewise

For the lower array.

Output should look like:

A: 0            a:2

B: 0             b:0

%u2026.


do we have to do A and Z and X and blah blah?

Explanation / Answer


#include <stdio.h>

#include <stdlib.h>

int main()

{

int upper[26],lower[26];

int i;

for(i=0;i<26;i++)

upper[i]=lower[i]=0;


char c;

printf("Enter a string: ");


while((c=getchar())!=' ')

{

if(c>='a' && c<='z')

{ lower[c-'a']++; }

else if(c>='A' && c<='Z')

{ upper[c-'A']++; }

}


printf(" Characters Counted ");

for(i=0;i<26;i++)

printf("%c: %d %c: %d ",i+'A',upper[i],i+'a',lower[i]);

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