Tuesday, 24 December 2013

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


#include<iostream.h>

#include<conio.h>

main()

{

   int year;

   clrscr();

cout<<"Enter any year : ";

   cin>>year;

   if((year%4==0&&year%100!=0)||(year%400==0)) {

cout<<"\n%d is a leap year."<<year;}

else

cout<<"\n%d is not a leap year."<<year;

   getch();

}

No comments:

Post a Comment