You are on page 1of 2

TẠO PROJECT CÓ TÊN: LAB2

6h00 – 8h30
1. Compute result of expression

x  sin( 2 x )  x 5
z e
Nhập x 
Tính z theo công thức
Math.pow(2,3)  8.0

2. Computer the area and circumference of the circle with known radius
Nhập radius
Tính chu vi, diện tích hình tròn
3. Write a program that reads three numbers from the command line: a, b, c. Then
compute area of the triangle

s  p( p  a)( p  b)( p  c)

p = (a+b+c):2
Nhập a,b,c là số nguyên
Tính chu vi tam giác
Tính nửa chu vi tam giác: p = Chu vi/2
Tính diện tích tam giác:

4. Write a program that enters the subjects’ scores of the students in semester I and
displays their score-board as following:
Từ bài 5-10 các em dùng lệnh if…else
5. Create a program that generates area of a rectangle
 Input: 2 sides of a rectangle (Integer type)
 Output: area of a rectangle
 Note: If any of two sides is less than 0, generates “N/A ”
Ex1: Input 2 3
Output 6
Ex2: Input 2 -3
Output N/A
6. Create a program that generates area of a circle
 Input: radius of a circle (Double type)
 Output: area of the circle (Double type)
 Notes: if input data is less than 0, generates “N/A”
7. How would you find the minimum of three values? of four? of five?
// Các em dùng lệnh if
Nhập x, y Ví dụ: x=4; y=5
Tìm ra min là x hay y
8. How would you find the maximum of three values? of four? of five?
9. Solve linear equation in one variable
bx + c = 0
Giải phương trình bậc 1. Nhập 2 số b,c là số nguyên
Khai báo x và tìm x.
10. Solve square equation in one variable
ax2 + bx + c = 0
- Giải phương trình bậc 2
- Nhập vào a,b,c
- Kiểm tra trường hợp a=0; b=0; c=0;
- Tính delta
- Dùng if để kiểm tra các trường hợp của delta.

You might also like