Write a function that consumes a non-negative integer k and prints a k-size diamond. A k-size diamond consists of a top, a middle and a bottom. The middle is a single row of 2k+1 d’s. The top consists of k rows. The i throw in the top (starting from 0) contains 2i+1 d’s. The d’s on each top row are centred over the d’s on the middle row. A bottom is like a top but upside down.
Ex. k = 2;
d
ddd
ddddd
ddd
d
please format code with </> button * homework policy * asking questions
int k;
int l;
void setup() {
size(400, 400);
k = 2;
textAlign(CENTER, CENTER);
String s = "d";
fill(255,0,0);
text(s + s + s + s +s, CENTER + 200, CENTER + 200);
}