Varanasi-Software-Junction / datastructures

A repository on Data Structures
MIT License
8 stars 5 forks source link

Ternary #17

Open champaksworldcreate opened 1 year ago

champaksworldcreate commented 1 year ago

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.