Computer Science, asked by ashish907826, 5 months ago

write a program to print first 7 even number​

Answers

Answered by keyboardavro
2

Answer:

Explanation:

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 sahiramonga
3

Answer:

answer

Explanation:

class abc {

void main( ) {

int I, evnum = 2;

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

System.out.println ( evnum );

evnum = evnum + 2;

}

}

}

Similar questions