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

Ternary #17

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

Ternary #17

champaksworldcreate opened this issue Jul 15, 2023 · 0 comments

Comments

@champaksworldcreate
Copy link
Contributor

Sure! Here are 10 problems related to the ternary operator in the C programming language:

  1. Write a program that takes three numbers as input and uses the ternary operator to find the maximum among them.
  2. Create a program that calculates the sum of all even numbers from 1 to n using the ternary operator.
  3. Write a C program that uses the ternary operator to determine whether a given year is a leap year or not.
  4. Implement a program that checks whether a given number is positive, negative, or zero using the ternary operator.
  5. Create a program that calculates the factorial of a given number using the ternary operator.
  6. Write a C program that takes two integers as input and uses the ternary operator to swap their values.
  7. Implement a program that calculates the average of three numbers using the ternary operator.
  8. Create a program that determines whether a given character is a vowel or a consonant using the ternary operator.
  9. Write a C program that takes three integers as input and uses the ternary operator to find the minimum among them.
  10. Implement a program that checks whether a given number is even or odd using the ternary operator.

These problems should help you practice using the ternary operator in various scenarios.

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