Hello you guys. Im doing this one homework assignment and i really need some help. My question is, How would you write an if statement that excludes the blank space and how would you write an if statement stating that its magenta when its inside the red space with the following guidelines. This is the problem:

In the grid below, each row/column intersection is a different color. Write an if-statement, possibly including many nested ifs and elses, to assign the right colors to each row and column. In your code, assume variables 'row' and 'col' give the row/col number. Based on the row/col values, assign one value into a char variable 'color', using the letter-abbreviations from the color legend below the grid. If row/col indicates a blank square, then assign no value at all (not even ' ') into 'color'. Don't declare the variables row, col, or color; assume they are already declared. Write just the if-statement described. You may use only as many ifs, elses, nots, ands, and ors as indicated, and may not use any #defines.

Use at most the indicated numbers of the following:

* 1 !'s
* 21 &&'s
* 4 else's
* 6 if's
* 5 ||'s

This is what ive done so far for the magenta part:

if ((col >= 19 && row < 16 & col >= 21 && row < 18 && col >= 25 && row < 22 && col < 27 && row < 12 && col < 29 && row >= 8) {
color = 'M';
else {
if ( col >= 18 && col < 30 && row >= 4 && row < 24)
color = 'R';

I know some statements dont make sense but thats why i need some help.

** see attached file ***

Why don't you write it out in English and then translate it into C? Just write down what you see in each row, 1 row at a time.

If it's row 1 or row 2 then the color is blue
if it's row 3 and the column is 3 or 4 then the color is green, else the color is blue

Notice that my statements can be translated very easily into if statements. You'll just need 2 for loops to loop through every row & column and select the right color.