Ask Question
1 August, 13:30

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.

+2
Answers (1)
  1. 1 August, 17:09
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers