Home > Mobile >  Android Pattern Logic
Android Pattern Logic

Time:11-22

enter image description here

This can anyone explain me this logic.

Here the answer I get is the actual answer which I want but I want to know the proper working flow behind this pattern.

THANKS

CodePudding user response:

 Your for loop will run for 10 times from 0-9.
then inside your for loop you inserted the color.
then your if condition states that when there is even place print white 
else black.(i%2==0 means even)

CodePudding user response:

if(i%2==0)
{
print"Black"
}else{
print"White"
}
  • Related