import java.util.Scanner;
class wloop
{
public static void main(String[] args)
{
int counter=2;
int sum=0;
while( counter<=200 )
{
sum = sum+counter ;
counter = counter+2;
}
System.out.println("The sum of integers from 2 to 200 is: " +sum);
}
}
import java.util.Scanner;
class wloop
{
public static void main(String[] args)
{
int sum=2;
while (sum <=200)
{
{
System.out.println(sum+ "");
sum+=2;
}
}
}
}
the first code count out the even number 2 - 200 and the secound show the line 2 4 ... 200. but i dont know how to to it like its going to to it in 1 program like this.
2
4
.
200
The sum of integers from 2 to 200 is:
can anyone help me on how i can do it white out a if?