write a program to print first 7 even number
Answers
Answered by
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
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