- Jan 12, 2003
- 219
- 0
- 0
import cs1.Keyboard;
public class ch3_4
{
public static void main (String[] args)
{
int value;
System.out.print ("Enter a value to begin the loop: ");
value = Keyboard.readInt ();
if (value <2)
System.out.print ("Illegal value, Enter another: ");
value= Keyboard.readInt ();
for (int count = 2; count != value; count *= 2)
System.out.println (count);
}
}
I need to write an app that takes the input and adds all the even numbers between the 2 and the input value.
The code i have written so far is intended to print the even numbers but not to add them yet. This never prints any output! Any suggestions?
MS
public class ch3_4
{
public static void main (String[] args)
{
int value;
System.out.print ("Enter a value to begin the loop: ");
value = Keyboard.readInt ();
if (value <2)
System.out.print ("Illegal value, Enter another: ");
value= Keyboard.readInt ();
for (int count = 2; count != value; count *= 2)
System.out.println (count);
}
}
I need to write an app that takes the input and adds all the even numbers between the 2 and the input value.
The code i have written so far is intended to print the even numbers but not to add them yet. This never prints any output! Any suggestions?
MS