Knowee
Questions
Features
Study Tools

Problem Statement:Find the sum of even numbers in the given range.Input Format:Accept two integer as inputOutput Format:Print the output as sum of even number available in the given rangeConstraints:1 <= INPUT <= 10^15Sample Input 1:10 20Sample Output 1:90Sample Input 2:30 33Sample Output 2:62

Question

Problem Statement:Find the sum of even numbers in the given range.Input Format:Accept two integer as inputOutput Format:Print the output as sum of even number available in the given rangeConstraints:1 <= INPUT <= 10^15Sample Input 1:10 20Sample Output 1:90Sample Input 2:30 33Sample Output 2:62

🧐 Not the exact question you are looking for?Go ask a question

Solution

To solve the problem, we need to find the sum of even numbers in a given range. The input format requires accepting two integers as input, representing the lower and upper bounds of the range. The output format requires printing the sum of the even numbers available in the given range.

To begin, let's define the problem statement and the input and output formats:

Problem Statement: Find the sum of even numbers in the given range.

Input Format: Accept two integers as input.

Output Format: Print the output as the sum of even numbers available in the given range.

Constraints: 1 <= INPUT <= 10^15

Sample Input 1: 10 20

Sample Output 1: 90

Sample Input 2: 30 33

Sample Output 2: 62

Now, let's break down the steps to solve the problem:

  1. Accept the two integers as input, representing the lower and upper bounds of the range.
  2. Initialize a variable "sum" to 0, which will store the sum of even numbers.
  3. Iterate through each number in the given range.
  4. Check if the current number is even by using the modulo operator (%). If the number modulo 2 equals 0, it is even.
  5. If the number is even, add it to the "sum" variable.
  6. After iterating through all the numbers in the range, print the value of "sum" as the output.

By following these steps, we can find the sum of even numbers in the given range.

This problem has been solved

Similar Questions

Write a program to accept an integer N and print the sum of first N odd numbersInput Format:An integer range is given inputOutput Format:Print only calculated sum.Constraints:1 <= N <= 10^16 Sample Input 1:2Sample Output 1:4Sample Input 2:10Sample Output 2:100

Sum of EvenSend FeedbackProblem Statement:Write a program that takes a tuple as input and prints the sum of all the even numbers in the tuple.Input:A tuple containing integer elements.Output:The sum of all the even numbers in the tuple.Sample Input:(2, 3, 4, 6, 7)Sample Output:12

Problem Statement:Write a  program to find the sum of numbers in the given range.Input Format:Given two integers start and end ranges separated by SPACE.Output Format:Print the sum in the given range.Constraints1<=start < end <= 1000000NOTE : The calculated sum value might exceed integer range.Sample Input 1:10 20Sample Output 1:165Sample Input 2:1 100Sample Output 2:5050

Write a program to print the odd values in the given rangeInput FormatTwo space separated integers - 'start' and 'end'Output FormatDisplay all the odd numbers between 'start' and 'end'Sample Input10 20Sample Output11 13 15 17 19

Write a program to print only the even numbers till given NInput FormatA single integer 'N'Output FormatDisplay all the even numbers between 0 and NSample Input10Sample Output0 2 4 6 8 10

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.