1. Right angles in Octagon

A quadrilateral can have four right angles. What is the largest number of right angles an convex octagon can have?

2. Hello, Ragi!

Did you make a sketch?

A quadrilateral can have four right angles.
What is the largest number of right angles an convex octagon can have?
Three . . . it can be done.

Code:
                        o
*       *
*               *
o                       o
*                           *
*                               *
*                                   *
o                                       o
*                                         *
*                                           *
*                                             *
o  90°                                     90°  o
*                                           *
*                                       *
*                                   *
*                               *
*                           *
*                       *
*                   *
*               *
*           *
*  90°  *
*   *
o

Obviously, there cannot be four right angles.