Skip to content

Latest commit

 

History

History

02-counting-the-number-of-characters

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Counting the Number of Characters

Problem Statement

Prompt for an input string and display output that shows the input string and the number of characters the string contains.

Example Output

What is the input string? Homer
Homer has 5 characters.

Constraints

  • Be sure the output contains the original string.
  • Use a single output statement to construct the output.
  • User a built-in function of the programming language to determine the length of the string.

Analysis

Inputs:

  • string

Processes:

  • prompt for a string
  • print the string and character count

Outputs:

  • string with character count

Test Plan

Input:

  • string: Homer

Expected result:

  • output: Homer has 5 characters.

Pseudocode

CountChars
  Prompt for string with "What is the input string?"

  Display string + " has " + count + " characters."
End