



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




NAME Ali Mumtaz Maaz ajmal ENROLLMENT FA23-EEE- FA23-EEE- SUBMISSION DATE 27/3/ SUBMITTED TO Dr.Irfan Ullah SECTION EEE-
Following figure shows a pattern of squares generated for different input values of N (for N=0 to N=5). Develop a general algorithm to fill in the grid for any input N. Use the 4 step process that was discussed in the class (and is given below for reference) The four ā step algorithm development process:
**1. Work an example yourself.
N Red Blue Green x y x y x y (^0 0 0 0 1 1 ) 1 0 1 1 1 0 2 1 0 - - 2 0 2 0 2 0 3 1 2 1 1 2 1 2 1 2 0 - - - - 3 0 3 1 3 0 4 1 2 3 1 2 2 2 1 - - 4 0 3 0 - - - - 4 0 4 0 5 1 4 1 3 2 3 3 2 2 2 4 1 5 0 3 1 - - - - 4 0 - - - - 5 0 5 1 5 0 6 1 4 3 3 2 4 2 3 5 1 4 2 3 2 - - 6 0 4 1 - - - - 5 0 - - - - 6 0 6 0 7 1 6 1 5 2 5 3 4 2 4 4 3 5 2 3 3 6 1 7 0 4 2 - - - - 5 1 - - - - 6 0 - - - -
Write down what you just did If N is input then consider x and y two variables as output For Red: