## write a program to display Sum of numbers from N to M in python?

Python program that prompts the user to input two integer values, N and M, representing the start and end points of the range of numbers we want to display the sum of.

Next, the program initializes a variable sum to zero and uses a for loop to iterate over each number in the range from N to M (inclusive). For each number, the program adds it to the sum variable.

Finally, the program displays the value of sum to the console using the print() function.

The program thus outputs the sum of all the numbers in the range from N to M.

Python program that prompts the user to input two integer values, N and M, representing the start and end points of the range of numbers we want to display the sum of. Then, it uses a for loop to iterate over each number in the range from N to M (inclusive) and adds it to a variable called sum. Finally, it displays the value of sum to the console using the print() function.

`N = int(input("Enter the value of N: ")) M = int(input("Enter the value of M: ")) sum = 0for i in range(N, M+1): sum += i print("The sum of numbers from", N, "to", M, "is", sum)`

In this program, we first prompt the user to enter the values of N and M using the input() function and convert them to integers using the int() function.

We then initialize a variable called sum to zero, which we will use to accumulate the sum of the numbers in the range from N to M.

Next, we use a for loop to iterate over all numbers from N to M (inclusive). For each number, we add it to the sum variable using the += operator.

Finally, we display the value of sum to the console using the print() function.

The program thus outputs the sum of all the numbers in the range from N to M.