DEFCOM1  
 

C# Lesson 4 - Math Operators

All computers really do is add numbers, lots of numbers

The basics

+

Add

-

Minus

*

Multiply

/

Divide

Activity

Create a program to;

Calculate the area of a square

Calculate the area of a rectangle

Calculate the area of a cuboid

 

C# also has provides maths functions for example Pi, Square Root and trigonometric functions

 

Basic example of PI and Square Root

 

Activity

Create a program to

Calculate the circumference of circle

Hint: Diameter multiplied by PI

Calculate the area of a circle

Hint: Pi * r 2 (Pi times Radius squared

 

Challenge

Can you create a Pythagoras Theorem program?

A 2+B 2 = C 2