Skip to content

Switch  #18

@champaksworldcreate

Description

@champaksworldcreate

Here are ten programming problems that you can solve using the switch statement in C:

  1. Write a program that takes a number as input and displays the corresponding month name using a switch statement.
  2. Create a program that prompts the user for a day of the week (e.g., 1 for Monday, 2 for Tuesday) and prints a message indicating whether it's a weekday or a weekend.
  3. Implement a calculator program that performs basic arithmetic operations (addition, subtraction, multiplication, division) based on the operator input using a switch statement.
  4. Write a program that takes a character as input and determines whether it is a vowel or a consonant using a switch statement.
  5. Create a program that converts a given letter grade (A, B, C, D, or F) into a corresponding GPA value using a switch statement.
  6. Implement a menu-based program that allows the user to choose different options (e.g., add, subtract, multiply, divide) and perform the corresponding operation using a switch statement.
  7. Write a program that takes a month number (1-12) as input and prints the number of days in that month using a switch statement.
  8. Create a program that prompts the user for a shape (e.g., circle, square, triangle) and calculates the area based on the user's choice using a switch statement.
  9. Implement a program that converts a given temperature in Celsius to Fahrenheit or vice versa based on the user's choice using a switch statement.
  10. Write a program that takes a character as input and determines whether it is an uppercase letter, lowercase letter, digit, or special character using a switch statement.

These problems will help you practice using the switch statement in C and improve your problem-solving skills. Good luck!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions