C Program To Check Leap Year Using Nested Ternary Operator
Satish B
http://technotip.com/6507/c-program-to-check-leap-year-using-ternary-operator/
C Program to Find if a given Year is a Leap Year or Not, using Ternary Operator.
General Form of Ternary Operator (expression_1) ? (expression_2) : (expression_3);
expression_1 is a comparison/conditional argument. expression_2 is executed/returned if expression_1 results in true, expression_3 gets executed/returned if expression_1 is false.
Leap Year Logic Leap Year
- If a year is a century year(years ending with 00) and if it’s perfectly divisible by 400, then it’s a leap year.
- If the given year is not a century year and it’s perfectly divisible by 4, then it’s a leap year.
Not Leap Year
- If the year entered is a century year(perfectly divisible by 100), but not perfectly divisible by 400. Then it’s not a leap year.
- A year which is not a century year and is not perfectly divisible by 4 is not a leap year.
C Programming Interview / Viva Q&A List http://technotip.com/6378/c-programming-interview-viva-qa-list/
C Programming: Beginner To Advance To Expert http://technotip.com/6086/c-programming-beginner-to-advance-to-expert/ ... https://www.youtube.com/watch?v=B8k0nI5HxnM
2020-07-21
0.34078741 LBC
Copyrighted (contact publisher)
8931231 Bytes