Example: Titles According to Age and Sex

Depending on age (decimal number and gender (m / f), print a personal title:

  • Mr.” – a man (gender “m”) - 16 or more years old.
  • Master” – a boy (gender “m”) under 16 years.
  • Ms.” – a woman (gender “f”) - 16 or more years old.
  • Miss” – a girl (gender “f”) under 16 years.

Sample Input and Output

Input Output Input Output
12
f
Miss 17
m
Mr.
Input Output Input Output
25
f
Ms. 13.5
m
Master

results matching ""

    No results matching ""