GNG1106 Lab 2
Pythagorean Triples
Designed By Yongyi Mao
Description
A positive-integer triple (a, b, c) with a < b < c and a2 + b2 = c2 is called a Pythagorean triple. Write a
program in C which takes a positive integer N as the input and prints
1. the t

GNG1106 Lab 5
Random Graphs
Designed By Yongyi Mao
Description
Let N be a positive integer and p be a number between 0 and 1. An (N, p) random graph is a graph generated
by the following procedure: Draw N vertices, denoted by 1, 2, . . . , N respectively;

GNG1106 Lab 1
Compute the Area of a Triangle
Designed By Yongyi Mao
Description
Write a program in C which takes the (x, y) coordinates of three points on the x-y plane as the input and
outputs the area of the triangle formed by the three points.
Input Fo

Moayad Aloqaily
GNG 1106 Lab
Introduction to CodeBlocks
C+
Prepared by:
Moayad Aloqaily
Contact: maloq025@uottawa.ca
1
Agenda
2
Getting Started
Download CodeBlocks
Create and compile your first program
Console applications
The fundamental parts of Cod

LAB REPORT
Objectives:
1.
4.
Input the (x, y) coordinates of three points on the x-y and output
the area of the triangle formed by the three points.
Use functions to calculate the Area
Using Heron's Formula to calculate the Area given 3 points
Experimenti

Question 1:
The output will be:
1nn2nn3nn4nn
This is because of the while loop: i=i+1; and because of the while(i)
Question 2:
The output will be:
4nn.
This is because of the while loop: i=i-1; and because of the while(i)
Question 3:
Textbook Chapter 3:

GNG1106 Lab 4
Simulation of a Fast-Food Restaurant
Designed By Yongyi Mao
Description
In this lab, you are to simulate the service of customers in a fast-food restaurant, and investigate the
behaviour therein.
The restaurant
Suppose that a fast-food resta

Fall 2012 GNG 1106 Final Exam
180 minutes
closed-book
non-programmable calculators allowed
The paper is out of 100 points, but you may get 107 points if you solve every question correctly. That
is, there are 7 bonus points.
1
Question 1 (513=65 points

GNG1106 Lab 3
The Monty Hall Problem
Designed By Yongyi Mao
Description
The Monty Hall Problem is a famous probability puzzle, based on a famous television game show. It goes
like follows. In each game, three doors are presented to the player, where behin

Pre-Lab Preparation
Prepare the answers to these questions and bring them to the lab.
1. For two right-angled triangles whose side lengths are all given, how do you
determine which one is "thinner"? Write the block of code implementing this in C.
int main

GNG1106 Midterm Exam: Fall 2012, Section A
75 minutes, Closed-Book
October 30, 2012
Question 1 (10 points, 6 minutes). There is one syntax error in the
following code. Indicate what the error is and the line number of the error.
75 minutes, Closed-Book |

GNG1106 Midterm Exam: Fall 2012, Section B
75 minutes, Closed-Book
October 29, 2012
Question 1 (10 points, 6 minutes). There is one syntax error in the
following code, please indicate what the error is and the line number of
the error.
75 minutes, Closed-

Engineering Economics
ECO 1192
Lecture 3: Single sums; Annuities; Payback Methods
Claude Thoret
University of Ottawa
Lecture Objectives
Study summary measures for decisionmaking
Single sums
Present worth and future worth
Annual equivalent method (annui