Program to find the sum of numbers in a given range | faceprep

Program to find the sum of numbers in a given range | faceprep

The program to find the sum of numbers in a given range is discussed here. Given the starting and ending interval, the sum of all the numbers in that range will be displayed as output.

program to the find the sum of numbers in a given range


For example,

Input: 1 10

Output: 55

Explanation: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55

Algorithm to find the sum of numbers in a given range

  • Input the start and end numbers.
  • Initialize sum = 0.
  • Repeat from i = start to and continue until i = end.
  • sum = sum + i
  • Print “sum”

The program to find the sum of numbers in a given range is given below.


program to find the sum of numbers in a given rangeClick here to learn more about FACE Prep PRO


@@coding::1@@


Recommended Programs



program to find the sum of numbers in a given range

c