# Bi-amonds
## Problem Description
> Create a diamond composed of 1s and 0s with an alternating pattern from the perimeter going towards the center of the diamond. Expect all the test cases to be odd numbers.
###### Input Sample
7
###### Output Sample
```
1
101
10101
1010101
10101
101
1
```
## Solution
> The pattern can only be printed out properly using odd numbers so when making test cases, make sure the test input is odd.
```java=
import java.util.Scanner;
//code only works for odd inputs
public class pattern2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int x = input.nextInt();
for(int i = 0, num = 0; i < x; i++ ) {
if(i < (x/2)) {
for(int j = 0; j < (x/2)-i; j++) {
System.out.print(" ");
}
for(int j = 0; j <= num; j++) {
if(j%2 == 0 && j == num)
System.out.println("1");
else if(j%2 == 0)
System.out.print("1");
else
System.out.print("0");
}
num+=2;
}
if(i >= (x/2)) {
for(int j = 0; j < i-(x/2); j++) {
System.out.print(" ");
}
for(int j = 0; j <= num; j++) {
if(j%2 == 0 && j == num)
System.out.println("1");
else if(j%2 == 0)
System.out.print("1");
else
System.out.print("0");
}
num-=2;
}
}
input.close();
}
}
```