Lab # 2

 

Objective:

Learn the operators, expressions and math functions.

 

Scope:

The student should know the following:

       1.         Problem Solving

      2.         Data Types

      3.         Arithmetic Expressions

      4.         Math Functions

      5.         Writing Complete Programs

 

Discussion:

The following problem will be discussed:


  1. Write a program that finds the area of a triangle given the length of its sides: a, b, c.

 

Exercises:

  1. Write a program that reads the lengths of two sides of a triangle and the angle between them and calculates the length of the third side using the following formula:


 

  1. Write a program that reads the volume of a sphere and finds the radius of it.

 

                         

 

Evaluation:

Your grade will depend on your active participation and seriousness during the lab.

 

                   Homework # 2                   [10 Marks]

1.      Write a program that reads a 3-digit integer n then it prints each digit in a line. If n is 325, it prints 5 in the first line, 2 in the second line, and 3 in the third line. (Hint: use % operator for remainder).

 

 

2.      Write a program that reads an integer n then it finds an approximation for n!  Using the following formula:

 

 

Notes:

 

  1. Submit your this home  work in next lab.
  2. Late work is not accepted.
  3. Copying will result in a grade of F in the course.