Ask Question
4 March, 04:19

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)

+3
Answers (1)
  1. 4 March, 04:31
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers