Question: Define function called percentage, given a string and a character, return the percentage of number of appearances of the character to the total number of

Define function called percentage, given a string and a character, return the percentage of number of appearances of the character to the total number of characters of the string. In main function, call the function on string "abcdab", and 'a'. Note that alphabetic characters are case-sensitive, so 'a' is different from 'A'. Examples: If the input string is "abcBba", and the character is 'b', return 333.3333. If the input string is "ab", and the character is 'a', return 50. If the input string is "abcdf', and the character is 'e', return 0.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!