Exercise 1:

Write a boolean method, called Prime, with an integer parameter to calculate if the parameter is a prime number.

Write a main method to get all the prime numbers until 100.

In order to calculate if a given integer n is prime it is necessary to check if the number is not divisible by any integer between 2 and the square root of n.

Exercise 2:

The PI number can be calculated as the value of the following infinite series
 PI = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 + ...
Write a method to calculate the value of PI as the sum of the n first values of this series, where n is a method parameter.

Write a main method to calculate Pi as the sum of the 1000 first values.

Exercise 3:

Write two methods. One to convert a temperature in Celsius into fahrenhait (F = 9 / 5 * C + 32). Other to convert a temperature in fahrenhait into celsius (C = 5 / 9 * ( F - 32 ))

Write a main method to print two temperature conversion tables, one for each convertions.

Exercise 4:

Write a method which takes two integer numbers as parameters, and calculates the largest integer number that can divide both of them.

For example, if the given numbers are 30 and 105, the largest common divider is 15.

Simplified algorithm (for positive numbers):

WHILE A * B != 0 
   IF A>B 
      A = A % B;
      B = B % A;

the Largest common divider is A+B;