



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A lab report on developing an algorithm to generate a pattern of squares for different input values of n (from 0 to 5). The report follows a four-step algorithm development process: working through an example, writing down the steps, generalizing the algorithm, and testing it. The algorithm involves filling the grid with red, blue, and green squares based on the values of x and y coordinates and whether n is even or odd. The document also includes a post-lab task to write a program that takes an integer input from the user and determines whether it is even or odd. This lab report could be useful for students studying computer programming, algorithms, and problem-solving techniques, particularly in the context of electrical and computer engineering.
Typology: Study Guides, Projects, Research
1 / 6
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: