Just for Fun, How to Code Snake And Ladder game pattern in Java
Aw, its a boring day at work today, we achieved almost everything for our sprint and sitting idle. We started playing snake and ladder game, and thought that we can also create a code to print Snake Ladder board pattern. Whoa here is the code...
public class SnakeLadder
{
static int temp = 101;
public static void main(String args[])
{
for(int i=5;i>0;i--)
{
for(int j=1;j<=10;j++)
{
temp--;
System.out.print(temp+" ");
}
System.out.println();
temp=temp-10;
for(int k=1;k<=10;k++)
{
System.out.print(temp+" ");
temp++;
}
temp=temp-10;
System.out.println();
}
}
}
Comments
Post a Comment