Download Course 161/2S3, Tutorial Sheet 3

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Infinitesimal wikipedia , lookup

Georg Cantor's first set theory article wikipedia , lookup

Location arithmetic wikipedia , lookup

Infinity wikipedia , lookup

Positional notation wikipedia , lookup

Law of large numbers wikipedia , lookup

Bernoulli number wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Large numbers wikipedia , lookup

Real number wikipedia , lookup

Elementary mathematics wikipedia , lookup

Addition wikipedia , lookup

Transcript
Course 161/2S3, Tutorial Sheet 3
• Write a C program which uses while loops to calculate the mean and
variance of N numbers. Modify the program so that it uses for loops
rather than while loops.
Note
The mean, x̄ of the numbers xi is
x̄ =
−1
1 NX
xi
N i=0
The standard deviation σ of the numbers is.
σ=
v
u
u
t
−1
1 NX
(xi − x̄)2
N i=0
!
• Write a C program which calculates the sum of the absolute values of
N numbers. Your program should read in N numbers first.
1