Write C program to enter any year and check whether year is leap year or not using conditional/ternary operator.
C program to check leap year using Conditional/Ternary operator C , OPERATOR , PROGRAM Write a C program to enter any year and check whether year is leap year or not using conditional/ternary operator (?:). Required knowledge: Basic C programming, Conditional operator, Leap year condition Leap year condition: If the year is EXACTLY DIVISIBLE by 4 and NOT DIVISIBLE by 100 then its LEAP YEAR Else if the yea r is EXACTLY DIVISIBLE 400 then its LEAP YEAR Else its a COMMON YEAR Program: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 /** * C program to check leap year using conditional operator */ #include <stdio.h> int main() { int year; /* ...
Comments
Post a Comment