Presentation is loading. Please wait.

Presentation is loading. Please wait.

Revision I This presentation gives you some hints for solution of selected problems.

Similar presentations


Presentation on theme: "Revision I This presentation gives you some hints for solution of selected problems."— Presentation transcript:

1 Revision I This presentation gives you some hints for solution of selected problems.

2 Outline Solution hint for Problem 2 – Group 10 of Assignment Sheets.
Solution hint for Problem 2 of Dr Khalil’s Revision Sheets 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; } Again this is only one way to do the function. 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 = n = n = n = 4 1   22   333  4444 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; } The slide gives one way for the solution. CSCE 106

6 Wish you all the best Please aim to arrive at 2:30 pm. CSCE 106


Download ppt "Revision I This presentation gives you some hints for solution of selected problems."

Similar presentations


Ads by Google