import java.io.*;
import java.util.*;
public class SummingNumbers
{
public static void main (String[] args)
{
int sum = 0;
Scanner value = new Scanner(System.in);
System.out.print("Enter starting value: ");
int x = value.nextInt();
System.out.print("Enter ending value: ");
int y = value.nextInt();
for (; x<=y; x++) //explain how this is working with just ; and no variable/number before it.
{
System.out.println(x);
sum += x;
}
System.out.println();
}
}
I had something in the System.out.println(); but deleted the variable and forgot to delete the line. Disregard that.

New Topic/Question
Reply



MultiQuote




|