Search Your C Program

Monday, 30 January 2012

Program to find whether a year is leap or not using conditional operators.

#include<stdio.h>
#include<conio.h>
void  main()

                  int year;
                  clrscr();
                  printf("\n Enter  the year");
                  scanf("%d",&year);
                  (( year % 100 ==0 && year % 400 == 0) || (year % 100 !=0 &&  year % 4 == 0))?
                  printf("\n Year  %d  is leap ",year):printf("\n Year  %d  is  not leap ",year);
                  getch();
}

No comments:

Post a Comment