Program Using Logical Operators To Display Whether The Given Year Is Leap Year Or Not
/* Program Using Logical Operators To Display Whether The Given Year Is Leap Year Or Not LEAP YEAR -> YEAR IS DIVISIBLE BY 4 AND NOT DIVISIBLE BY 100 (OR) YEAR IS DIVISIBLE BY 400 NOTE: ABOVE FORMULA IS VALID ONLY FOR THE YEARS BEYOND 1400 A.D. ******* */ #include
#include
void main() { int y; clrscr(); printf("\nEnter a year\n\n"); scanf("%d",&y); if(y>=1400) { if((y%4)==0&&(y%100)!=0||(y%400)==0) printf("\ngiven year is leap year"); else printf("\ngiven year is non-leap year"); } else printf("\ninvalid year"); getch(); }
Please send comments to
vgdarur.javafive@blogger.com
Copyright © 2008 - iForeRunner.com
http://www.iforerunner.com/