Program to display the sum and and average of all even and odd numbers// between 1 and 100.

class test1
{
public void work()
{

int a,b,c,d,sum1=0, sum2=0;
float avg1, avg2;
for(a=1;a<=100;a++)
{
if (a%2 == 0)
sum1 = sum1 + a;
else
sum2 = sum2 + a;
}
avg1 = sum1/50;
avg2 = sum2/50;
System.out.println("The sum of even numbers is "+sum1);
System.out.println(" and the average is "+avg1);
System.out.println("The sum of odd numbers is" +sum2);
System.out.println("and the average is "+avg2);
System.out.println("Press any key to continue");
}
}