I have the following exercise that asks me to define a range and sum all the even values of that range showing which numbers added together, of the sort:
Min = 10
Max = 1510 + 12 + 14 = 36.
However. the output I get is:
10 + 12 + 14 + = 36.
I mean, I have an "+" more. I leave here the code:
int min = 0;
int max = 0;
do{
do{
System.out.println("Insira um valor min:");
min = scanner.nextInt();
System.out.println("Insira um valor max:");
max = scanner.nextInt();
}while (min<0 || max >100);
}while(min>max);
int i = 0;
while((min<max))
{
if(min % 2==0)
{
i+=min;
System . out . print(min + "+");
}min++;
}
System . out . print("=" + i);