Computer Science, asked by sharmapushkar800, 7 months ago

Hi, Please help me in writing codes​

Attachments:

Answers

Answered by sahanasusamagmailcom
0

Answer:

class JavaExample {

public static void main(String args[]) {

int n = 100;

System.out.print("Even Numbers from 1 to "+n+" are: ");

for (int i = 1; i <= n; i++) {

//if number%2 == 0 it means its an even number

if (i % 2 == 0) {

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

}

}

}

}

Similar questions