Computer Science, asked by dilipkale, 7 days ago

1 ANSWER THE FOLLOWING :-
Write a program to print even numbers from 2 to 200.​

Answers

Answered by yuvanaidu
0

Answer:

Here is a Java program that uses a for loop to print even numbers from 2 to 200:

public class EvenNumbers {

   public static void main(String[] args) {

       for (int i = 2; i <= 200; i += 2) {

           System.out.print(i + " ");

       }

   }

}

This program uses a for loop to iterate from 2 to 200, incrementing the value of i by 2 in each iteration. Inside the loop, the current value of i is printed to the screen. Since the i is incremented by 2 in each iteration, it will only print even numbers.

Similar questions