Problem Analysis:
The problem is to input the two integers from the user and displays the sum of even numbers between them.For this we need two input variables(a,b) ,a calculation parameter (sum) and another variables(i) for the loop.
Input variables Processing variables Output variables Necessary header files
a(int) sum=sum+i; sum(int) conio.h
b(int) stdio.h
i(int)
sum(int)=0
Algorithms:
1.start
2.Define a,b,i,sum=0
3.Input a,b from the user.
4.Calculation
if (a>b)
for(i=b;i<=a;i++)
if(i%2==0)
sum=sum+i;
if(b>a)
for(i=a; i<=b; i++)
if(i%2==0)
sum=sum+i;
5.Print sum
6.Stop.
Codes:
outputs:
Compiling , Debugging and testings.
Enter any two numbers: 2 8
20