
class evsum { public static void main(String args[]) { int i,sum=0; for(i=1;i<=20;i++) { i=i%2; if(i==0) {
sum=sum+i;
}
} System.out.println("sum of even no between 1 and 20="+sum); } }

class evsum {
public static void main(String args[]) {
int sum=0;
for(int i=1;i<=20;i++) {
if(i%2==0){
sum=sum+i;
}
}
System.out.println("sum of even no between 1 and 20="+sum);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.