Ask Question

Given is the array prices with 100 elements (prices[100]). The problem consists of two parts: 1. Find the highest price in the array; and 2. Reduce that price by 10% For any three numbers input by the user, output the numbers in ascending order.

+5
Answers (1)
  1. 1 November, 06:29
    0
    1. Input array of 100 numbers

    mx = 0

    for (int i = 0; i < 100; i++)

    if (arr[i] > mx)

    mx = arr[i]

    Output mx

    2. Input array of 100 numbers

    mx = 0

    for (int i = 0; i < 100; i++)

    if (arr[i] > mx)

    mx = arr[i]

    mx = mx * 0.9

    3. Input three numbers

    if (firstNumber > secondNumber) {

    swap (firstNumber, secondNumber)

    }

    if (firstNumber > thirdNumber) {

    swap (firstNumber, thirdNumber)

    }

    if (secondNumber > thirdNumber) {

    swap (secondNumber, thirdNumber)

    }

    output firstNumber, secondNumber, thirdNumber
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Given is the array prices with 100 elements (prices[100]). The problem consists of two parts: 1. Find the highest price in the array; and ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers