<< Home | <<C Programs Home



c programs to check given year is leap year or not using conditional operator.

Page<< C Programs Home
Page<< C Programs Home
  

C Program :

Write a prog. to check given year is leap year or not using conditional operator. Do not use logical operators.

C Programming -->

/* PROG. TO CHECK GIVEN YEAR IS LEAP YEAR OR NOT */ /*USING CONDITIONAL OPERATOR, LOGICAL OPERATOR IS NOT USED */ #include<stdio.h> #include<conio.h> main() { int y,leap; clrscr(); printf("enter any year"); scanf("%d",&y); . leap=(y%4==0)?( (y%100==0)? ( (y%400==0)? 1 : 0) : 1) : 0; if(leap ==1) printf("%d is leap year" ,y); else printf("%d is not a leap year" ,y); getch(); }
Page<< C Programs Home



 
Copyright © 2006-2012 ExamBlast.com Last Updated 08-April-2012