Thursday, January 20, 2011

Write a program using conditional operators to determine whether a year entered through the keyboard is a leap year or not.

#include<stdio.h>
main()
{

int year;

printf("Enter a year:");
scanf("%d", &year);

(year%4==0)?(printf("Leap Year")):(printf("Not a Leap Year"));

}

No comments:

Post a Comment