Question

In: Computer Science

Write a C program named as listLetterFreq.c that lists the frequency of the letters from the...

Write a C program named as listLetterFreq.c that lists the frequency of the letters from the input via ignoring the case sensitivity. For example, sample outputs could be like below.

Please input a string:

This is a list of courses. CSC 1010 - COMPUTERS & APPLICATION

Here is the letter frequency:

Letter a or A appears 3 times

Letter b or B appears 0 times

Letter c or C appears 5 times

Letter d or D appears 0 times

Letter e or E appears 2 times

Letter f or F appears 1 times

Letter g or G appears 0 times

Letter h or H appears 1 times

Letter i or I appears 5 times

Letter j or J appears 0 times

Letter k or K appears 0 times

Letter l or L appears 2 times

Letter m or M appears 1 times

Letter n or N appears 1 times

Letter o or O appears 4 times

Letter p or P appears 3 times

Letter q or Q appears 0 times

Letter r or R appears 2 times

Letter s or S appears 8 times

Letter t or T appears 4 times

Letter u or U appears 2 times

Letter v or V appears 0 times

Letter w or W appears 0 times

Letter x or X appears 0 times

Letter y or Y appears 0 times

Letter z or Z appears 0 times

Solutions

Expert Solution

C PROGRAM ====>

#include <stdio.h>

int main() {
char str[1000]; // max size is 1000


printf("Enter a string: ");
fgets(str, sizeof(str), stdin);

char str1[] = "abcdefghijklmnopqrstuvwxyz"; // alphabets in small letter
char str2[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; // alphabets in capital letter


for(int i=0;i<26;i++)
{
int count=0;
for (int j = 0; str[j] != '\0'; ++j)
{
if (str1[i] == str[j] || str2[i] == str[j]) // compare character of str with str1 and str2
{
++count;
}
}
printf("Letter %c or %c appears %d times\n",str1[i],str2[i],count);
}

return 0;
}

OUTPUT SCREENSHOT ===>


Related Solutions

In a c programming Write a program that converts upper case letters to lower case letters...
In a c programming Write a program that converts upper case letters to lower case letters or vice versa: Enter a sentence: What a GREAT movie is! Converted sentence: wHAT_A_great_MOVIE_IS_ Convert all non-alphabetical letters to ‘_’
In C++, write a program that will read up to 10 letters (characters) into an array...
In C++, write a program that will read up to 10 letters (characters) into an array and write the letters back to the screen in the reverse order. The program should prompt the user to input all values and can determine whether the input has ended by a punctuation mark such as ‘.’ (make sure that you’ll include meaningful and intuitive messages to the user). For example, if the input is abcde, the output should be edcba. Include appropriate messaging...
How do I write a C++ program to call a frequency table from a csv file,...
How do I write a C++ program to call a frequency table from a csv file, using vector? Data given is in a csv file. Below is part of the sample data. Student ID English Math Science 100000100 80 90 90 100000110 70 60 70 100000120 80 100 90 100000130 60 60 60 100000140 90 80 80
C LANGUAGE ONLY Write a C program to count the frequency of each element in an...
C LANGUAGE ONLY Write a C program to count the frequency of each element in an array. Enter the number of elements to be stored in the array: 3 Input 3 elements of the array: element [0]: 25 element [1]: 12 element [2]: 43 Expected output: The frequency of all elements of an array: 25 occurs 1 times 12 occurs 1 times 3 occurs 1 times
C++ Write a program that lets the user enter a two letters which are f and...
C++ Write a program that lets the user enter a two letters which are f and s with a length of 5. And outputs how many times it was occurred and lists the 2 most repeating pattern with 5lengths of f and s. The output display should always start at three-f(s) .Include an option where user can retry the program. Example: Input: sssfsfsfssssfffsfsssssfffsffffsfsfssffffsfsfsfssssfffffsffffffffffffssssssssfffsffffsssfsfsfsfssssfffsssfsfsffffffssssssffffsssfsfsfsss Output: The most repeating 5lengths of pattern is: fffsf and occurred 6times. Output2: The second most repeating...
Write a C++ program that makes a 10x10 array and picks random letters and displays in...
Write a C++ program that makes a 10x10 array and picks random letters and displays in different positions
using C# Write a program named RectangleArea tocalculate the area of a rectangle with a...
using C# Write a program named RectangleArea to calculate the area of a rectangle with a length of 15.8 and a width of 7.9. The program should have two classes, one is theRectangleArea holding the Main(), and the other one is Rectangle. The Rectangleclass has three members: a property of length, a property of width, and a method with a name of CalArea() to calculate the area. You can invoke the auto-provided constructor or write a self-defined constructor to initialize...
Write a C++ program that start the assignment by creating a file named pointerTasks.cpp with an...
Write a C++ program that start the assignment by creating a file named pointerTasks.cpp with an empty main function, then add statements in main() to accomplish each of the tasks listed below. Some of the tasks will only require a single C++ statement, others will require more than one. For each step, include a comment in your program indicating which step you are completing in the following statement(s). The easiest way to do this is copy and paste the below...
Write a C++ program that start the assignment by creating a file named pointerTasks.cpp with an...
Write a C++ program that start the assignment by creating a file named pointerTasks.cpp with an empty main function, then add statements in main() to accomplish each of the tasks listed below. Some of the tasks will only require a single C++ statement, others will require more than one. For each step, include a comment in your program indicating which step you are completing in the following statement(s). The easiest way to do this is copy and paste the below...
Write a C++ program named, myGrade.cpp, that calculates a letter grade for a student of this...
Write a C++ program named, myGrade.cpp, that calculates a letter grade for a student of this course (CSC100 online) based on three user inputs. This program should begin by printing the title of the application (program) and a brief description of what it does. (Note: this is NOT the same as the program prolog: a prolog is much more detailed, has required elements, and is intended for other programmers reading the cpp file. The title and description displayed by the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT