Computer Science, asked by shivanshi8909, 3 days ago

write a program to display even number from 10 to 50 by java using for loop​

Answers

Answered by ashritagaonkar19
2

Explanation:

public class DisplayEvenNumbersExample1

{

public static void main(String args[])

{

int number=100;

System.out.print("List of even numbers from 1 to "+number+": ");

for (int i=1; i<=number; i++)

{

//logic to check if the number is even or not

//if i%2 is equal to zero, the number is even

if (i%2==0)

{

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

}

}

}

}

Similar questions