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
2
CORRECT CODE.
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
Math,
1 month ago
English,
1 month ago
English,
2 months ago
Social Sciences,
10 months ago
Math,
10 months ago