Computer Science, asked by ronaksahu58141, 2 months ago

int y[]={1999,2000,1996,1947}; for(i=0;i<4;i++) { if(y[i]%4==0) System.out.println(y[i]); }

Answers

Answered by anindyaadhikari13
2

CORRECT CO‎‎‎‎‎‎DE.

int y[]={1999,2000,1996,1947};

for(int i=0;i<4;i++) {

  if(y[i]%4==0)

    System.out.println(y[i]);

}

OUTPUT.

2000

1996

EXPLANATION.

  • Here the loop is used to iterate through array elements.
  • If any number present in array is divisible by 4, then it is displayed on the screen.
  • Here we can see that only 2 numbers in the array are divisible by 4 i.e., 2000 and 1996. So, they are displayed on the screen.
Attachments:
Similar questions