Ask Question
9 May, 14:00

Ask the user for two positive integers; the first number, a, should be less than the second number, b. Print the average of the numbers from a to b inclusive. [ For example: If the user enters 3 and 7, the code should print 5 ((3+4+5+6+7) / 5). ] (python coding)

+5
Answers (1)
  1. 9 May, 16:26
    0
    What you need to do here is increment. Begin by asking the user for the two inputs like you were (one smaller than the other) then you would need a loop that kept creating new integers until the desired maxNum is reached. I can write this in Java but not python. in java you would need a 'while loop' and the incrementation '++'. So int1 = 3 and int2 = 7

    While (int1 < int2; int++) {

    intAverage = (('integers') / integers. length ();

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Ask the user for two positive integers; the first number, a, should be less than the second number, b. Print the average of the numbers ...” 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