Download - Revision I
![Page 1: Revision I](https://reader036.vdocument.in/reader036/viewer/2022080905/56813034550346895d95ca3b/html5/thumbnails/1.jpg)
Revision I
![Page 2: Revision I](https://reader036.vdocument.in/reader036/viewer/2022080905/56813034550346895d95ca3b/html5/thumbnails/2.jpg)
CSCE 106 2
Outline Solution hint for Problem 2 – Group 10 of
Assignment Sheets. Solution hint for Problem 2 of Dr Khalil’s
Revision Sheets
![Page 3: Revision I](https://reader036.vdocument.in/reader036/viewer/2022080905/56813034550346895d95ca3b/html5/thumbnails/3.jpg)
CSCE 106 3
Solution Hint for Problem 2 – Group 10 of Assignment Sheets
A boolean function the determines whether a number x is prime. bool prime(int x){ bool flag = true; int i = 2; while (i < x && flag) if (x % i == 0)
flag = false; else i++; return flag;}
![Page 4: Revision I](https://reader036.vdocument.in/reader036/viewer/2022080905/56813034550346895d95ca3b/html5/thumbnails/4.jpg)
CSCE 106 4
Solution Hint for Problem 2 of Dr Khalil’s Revision Sheets
Generating the following graphics that depends on n.
Graphics for Graphics for Graphics for Graphics for n = 1 n = 2 n = 3 n = 4 1 1 1 1
22 22 22 22 22 22
333 333 333 333 333 333
4444 4444 4444 4444
![Page 5: Revision I](https://reader036.vdocument.in/reader036/viewer/2022080905/56813034550346895d95ca3b/html5/thumbnails/5.jpg)
CSCE 106 5
Solution Hint for Problem 2 of Dr Khalil’s Revision Sheets (cont’d)
for (int i = 1; i <= n; i++)
for (int j = 1; j <= i; j++)
{
for (int z = 1; z <= i; z++)
cout<<i;
cout<<endl;
}
![Page 6: Revision I](https://reader036.vdocument.in/reader036/viewer/2022080905/56813034550346895d95ca3b/html5/thumbnails/6.jpg)
CSCE 106 6
Wish you all the best