Question and answer is powered by AnsPress.io
I want to write a program to add even number using command line argument.
class command {
public static void main(String ar[]) {
int a=0,b;
for(int x=0;x<ar.length;x++) {
b=Integer.parseInt(ar[x]);
if(b%2==0)
a=a+b;
}
System.out.println(a);
}
}