Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Could you explain this program line by line? Q.2) Write a program that asks the user to enter two positive integers. Your program should loop
Could you explain this program line by line?
Q.2) Write a program that asks the user to enter two positive integers. Your program should loop from the lower number to the higher number and sum all of the values not divisible by 5. Print the final sum. For example, if the user enters the numbers 13 and 4 your program would print the value of 4+6+7+8+9+11+12+13. Answer: a = int(input("Enter a number: ")) b = int(input("Enter a number: ")) if a>b: temp = b b = a a = temp sum=0 for i in range (a,b+1): if i % 5 != 0 : sumtri print(sum)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started