Source Code
#include <iostream>using namespace std;
int main(){
int num;
int min,max;
long sum =0;
cout << "Enter the Starting range: ";
cin >> min;
cout << "Enter the End range: ";
cin >> max;
for(num = min;num <= max; num++)
if(num % 2 ==0)
sum = sum + num;
cout << "Sum of Even numbers in given range is: " << sum;
return 0;
}
No comments: