PRF192_-_PE1_-_FA2024_2926.webp
M

PRF192_-_PE1_-_FA2024_2926.webp

  • Media owner Maki95
  • Ngày thêm
+ Write the code on only one file, named the file: PRF192_FA24.c
+ Students are not permitted to use input/output statements for questions 1 to 4. All input data must be passed via function arguments, and the output should return by arguments or return value.
+ Students can write additional functions for code convenience
Questions:
1. Write a function to calculate area of a triangle. (1.5 marks)
Hint: Formula for triangle area: S=p(pa) (pb)(pc) with p=(a+b+c)/2. a,b,c are 3 sides of triangle. The function should return -1 for invalid triangle.
2. Write a function that calculates the total year-end bonus each employee receives based on their sales under the following conditions: if your annual sales are below $100,000, you will only receive a year-end bonus of $1,000. If your sales are between $100,000 and $120,000, you will receive 1% of the amount exceeding $100,000. If your sales are between $120,000 and $140,000, you will receive 2% of the amount exceeding $120,000. If your sales exceed $140,000,you will receive 3% of the amount exceeding $140,000.(2 marks).
3. Write a function to calculate S according to the following formula (n > 0): (2 marks)1!2!3!n!1+2+n+√1 + √2 + √3 + ... + √ S=++1+√1 1+2+√1+√2 1+2+3+√1 + √2 + √3
4. Write a function that returns a list of even elements and sorts them in ascending order from an unsorted array of integers (1.5 marks)
Zoom

+ 100%
Close
  • Like
Reactions: Phongnt5
Chưa có bình luận nào.

Thông tin

Category
PRF192
Thêm bởi
Maki95
Ngày thêm
Lượt xem
1,434
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRF192_-_PE1_-_FA2024_2926.webp
File size
231.5 KB
Dimensions
1145px x 668px

Share this media

Back
Bên trên Bottom