Witam mam drobyny problem z programem.
Program ma sumowac liczby parzyste.
import java.util.Scanner;
class P3LoopRange
{
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
int firstvalue;
int secondvalue;
int sum;
System.out.println("Please, enter your initial value: ");
firstvalue=input.nextInt();
System.out.println("Please, enter your finish value: ");
secondvalue=input.nextInt();
if (firstvalue %2=0)
{
for (int i=firstvalue; i<=secondvalue; i=i+2)
{
sum+=i;
System.out.println("The sum of the even numbers in the range is: " +sum);
}
}
else
if (firstvalue %2!=0)
{
for (int i=firstvalue+1; i<=secondvalue; i=i+2)
{
sum+=i;
System.out.println("The sum of the even numbers in the range is: " +sum);
}
}
}
}