Skip to content

Latest commit

 

History

History
20 lines (18 loc) · 1.12 KB

Problems.md

File metadata and controls

20 lines (18 loc) · 1.12 KB

- Important Notes -

  • you must try to solve the problem first then, read my Solution :)

Problems

1. Student Struct

  • Create a struct to store information about a student, such as name, age, and GPA.
  • Write a function that accepts an array of students and prints the student with the highest GPA.
  • The Solution

2. Point Struct and Distance Calculation

  • Define a Point struct with x and y coordinates.
  • Write a function to calculate the distance between two points using the distance formula:
    • Distance Formula: distance = sqrt((x2 - x1)^2 + (y2 - y1)^2)
  • The Solution

3. Rectangle Area Calculation

  • Define a Rectangle struct that holds the coordinates of two opposite corners of a rectangle.
  • Write a function to calculate the area of the rectangle based on the corner points.
    • Area = |(x2 - x1) * (y2 - y1)|
  • The Solution