Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch #18

Open
champaksworldcreate opened this issue Jul 16, 2023 · 0 comments
Open

Switch #18

champaksworldcreate opened this issue Jul 16, 2023 · 0 comments

Comments

@champaksworldcreate
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant