Computer Science, asked by richashukla0202, 2 months ago

. Write a program to print first 10 even number by 'while loop'
S:​

Answers

Answered by raushan7393
0

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