Computer Science, asked by wazbir81hazarika, 8 months ago

write a javascript program to find out the even numbers between 0-20 using while loop​

Answers

Answered by sreeraj7034444680
0

Answer:

class JavaExample {

  public static void main(String args[]) {

int n = 20;

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

   }

}

  }

}

Explanation:

Answered by kumarkshitij552
0

Answer:

Here is your answer mate:- but its a simple snippet

and of course its a console run program if u want HTML one then reply.

Explanation:

i=0

while ( i<=20)

{

 // let's divide the value by 2

 // if the remainder is zero then it's an even number

     if(i % 2 == 0

{

   console.log(i);

 }

}

Similar questions