C Program To Find Sum of All Even Numbers Between Range, using While loop

preview_player
Показать описание

Lets write a C program to find sum of all the even numbers between range or between 2 integers input by the user.

Even Number: An even number is an integer that is exactly divisible by 2.

For Example: 10 % 2 == 0. When we divide 10 by 2, it give a reminder of 0. So number 10 is an even number.

Note: In this C program we ask the user to input start and end value. We assume that the user enters bigger value for variable end and smaller value for variable start.

If user enters start = 10 and end = 20. C program finds all the even numbers between 10 and 20, including 10 and 20. So the even numbers are 10, 12, 14, 16, 18, 20. We add all these even numbers and output the sum to the console window. i.e., 10 + 12 + 14 + 16 + 18 + 20 = 90. We out put the value 90 as result.

C Programming Interview / Viva Q&A List

C Programming: Beginner To Advance To Expert
Рекомендации по теме
Комментарии
Автор

What if you want to calculate for average inside this code?

daniellandubueze
Автор

Write a program in MATLAB using a (for instruction) to find the summation of even numbers from (16 to 26).
How do I solve this.
Help me please!🥺

Mays
Автор

What if you want to calculate for average inside this code?

daniellandubueze