public class Maxeven {
public static void main (String [] args){
int c,n,max,countEven;
countEven=0;
max = 0;
SimpleInput sInp;
c=1;
while(c<=10){
sInp= new SimpleInput();
n = sInp.getInt("Please Enter an Integer");
if(n%2==0){
max=n;
countEven=countEven+1;
c=c+1;
while(c<=10){
sInp= new SimpleInput();
n = sInp.getInt("Please Enter an Integer");
if(n%2==0){
if(n>max){
max=n;
c=c+1;
}
else{
c=c+1;}
}
else {
c=c+1;}
}
System.out.print(" The Maximum even Number is : " + max);
}
else {
c=c+1;
}
}
if(countEven==0)System.out.print(" No even Number Found ");
}
}
No comments:
Post a Comment