#C13985. Filtered Fruit Prices
Filtered Fruit Prices
Filtered Fruit Prices
You are given a fixed list of fruits: apple
, banana
, cherry
, date
, and elderberry
. You will receive 5 space‐separated integers as input, each representing the price of the corresponding fruit in the order given. Your task is to output each fruit whose price is strictly greater than 5. For each qualifying fruit, output a line containing the fruit name followed by its price, separated by a single space. If no fruit has a price greater than 5, output -1
.
Note: Read input from standard input and write output to standard output.
inputFormat
A single line containing 5 space-separated integers. These integers represent the prices for the fruits in the following order: apple, banana, cherry, date, elderberry.
outputFormat
For each fruit with a price greater than 5, output a line containing the fruit name and its price, separated by a space, in the same order as the input. If no fruit qualifies, output -1.## sample
3 7 2 8 6
banana 7
date 8
elderberry 6
</p>