Home Segments Index Top Previous Next

174: Practice

Write a program that displays a message indicating the deviation of a company's price–earnings ratio from the average price–earnings ratio, truncated to the nearest integer, of the form The company is overvalued or undervalued by number percentage points. Your program's input is four numbers: price per share, shares outstanding, earnings, and average price–earnings ratio. Be sure that, if the deviation is just 1 percent, the word point, rather than points, appears.