/* SUM OF EVEN NUMBER */
import java.io.*;
class ssva18
{
public static void main(String arg[])
{
long n=0;
System.out.print("\nSUM OF EVEN NUMBERS IN BETWEEN 1 & 50\n\n\n");
for(int i=1;i<=50;i++)
{
if(i%2==0)
{
System.out.print(" "+i);
n=n+i;
}
}
System.out.println("\n\n\nSUM OF EVEN NUMBERS BETWEEN 1 & 50 IS : "+n);
System.out.println("\n");
}
}In this program, easy to understand to calculate sum of even numbers using Java Program.
