Computer Science, asked by sunitagupta54637, 11 months ago

Write a JavaScript code to display even numbers from 1 to 100 using any looping statement.

Answers

Answered by EnergyFormE
1

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 + " "); } } } }

Answered by ndjaat2007
0

Answer:

Answer is in above pic..........

Attachments:
Similar questions