Problem Set 3: Conditional Statements - 46

Problem Set 3.1: Conditional Statement [3]

  1. Zero, Positive, Negative - Number Sign Test

    1. Determine whether an Integer Number is Zero or not. (Similar)

    2. Determine whether a Number is Positive, or Negative. (Similar)

    3. Determine whether a Number is Positive, Negative, or Zero.

  2. Test the Voting eligibility of a person based on their Age.

  3. Test Equality of Two Complex Numbers.

Problem Set 3.2: Relational Operator [12]

  1. Testing Equality

    1. Test whether Two Numbers are Equal or Not.

    2. Print a Digit into a Word. [One for 1, Two for 2, etc.]

    3. Input 1-7 and print the Day of the Week. (Consider 1 for Sunday, 2 for Monday, etc.)

    4. Input 1-12 and print the Month of the Year. (Consider 1 for January, 2 for February, etc.)

    5. Test whether a Number is a Perfect Square or Not.

    6. Test whether a Number is a Perfect Cube or Not.

    7. Test whether a Number is a Power of Two or Not.

    8. Calculate the Power of a Number (Base^Exponent) [Consider both Base and Exponent as integer, and 0<=Exponent<=5] [No Built-in Function, Loop, or Recursion can be used, use only if, else]

  2. Comparison (Less Than/Greater Than)

    1. Determine Pass/Fail based on the Marks of an Exam. [Pass: 100-40, Fail: 39-00] [Consider only integer marks]

    2. Test the Voting eligibility of a person based on their Year of Birth.

    3. Calculate the Absolute Value of a Number.

    4. Determine Profit or Loss from Cost Price and Selling Price.

Problem Set 3.3: Logical Operator [3]

  1. Find the Grade of an Exam based on the Marks of an Exam. [Consider the Following Range for Grade: A+ (100-80), A (79-70), B (69-60), C (59-50), D (49-40), F (39-0)] [Consider only integer marks]

  2. Classify Temperature in Celsius into the following categories: Freezing, Cold, Mild, Warm, and Hot.

  3. Classify Body Mass Index (BMI) into the following categories: Underweight, Normal, Overweight, and Obese. (Calculate the BIM using weight and height as input)

Problem Set 3.4: Maximum, Minimum, Median, Sorting [9]

  1. Find the Maximum between Two Numbers.

  2. Find the Minimum between Two Numbers.

  3. Find the Maximum between Three Numbers.

  4. Find the Minimum between Three Numbers.

  5. Find the Middle Value among Three Numbers.

  6. Sort Three Numbers in Ascending Order.

  7. Sort Three Numbers in Descending Order.

  8. Find the Maximum of Four Numbers.

  9. Find the Minimum of Four Numbers.

Problem Set 3.5: Divisibility [6]

  1. Test whether an Integer Number is EVEN or ODD.

    1. Determine using the Modulus Operator.

    2. Determine using the Bitwise Operator.

    3. Try to Find more Alternative Solutions.

  2. Test whether an Integer Number is divisible by three (3) or not.

  3. Input an Integer Number, print Fizz if it is divisible by 3, print Buzz if it is divisible by 5, and print FizzBuzz if it is divisible by both 3 and 5.

  4. Test whether a Year is a Leap Year or Not.

  5. Test whether a Year is a Century Leap Year or Not.

  6. Test the Divisibility of a Number by Another Number.

Problem Set 3.6: Time and Date [6]

  1. Validate a Time. (Consider 24 Hours Format)

  2. Validate a Time. (Consider 12 Hours Format)

  3. Validate a Date. (Consider 12 Months, Each Month has 30 Days, and there is no Leap Year)

  4. Print the Total Number of Days in a Year. (Must consider Leap Year)

  5. Print the Total Number of Days in a Month. (Input Month as Number. (Consider 1 for January, 2 for February, etc.)) [No Need to Consider Leap Year]

  6. Input MM/YYYY and print the Total Number of Days in that Month of that Year. (Must consider Leap Year)

Problem Set 3.7: Geometrical Operation [7]

  1. Test whether a Triangle is Valid or Not based on the Lengths of Three Sides.

  2. Test whether a Triangle is Valid or Not based on the Three Angels.

  3. Classify a Triangle based on the Length of Three Sides into the following categories: Equilateral, Isosceles, and Scalene.

  4. Classify a Triangle based on a given Angle into the following categories: Acute-Angled, Right-Angled, and Obtuse-Angled Triangle.

  5. Determine the quadrant (I, II, III, or IV) of a Point (x, y) in a coordinate system.

  6. Test whether a Point (x, y) (coordinates) lies inside a circle with a given radius and center.

  7. Determine the roots of a quadratic equation. (Take Coefficients as Input [a, b, c, in ax2+bx+c=0ax² + bx + c = 0])

Last updated