Tuesday 24 December 2013

Any year is input through the keyboard. Write a program to determine whether the year is a leap year or not. (Hint: Use the % (modulus) operator) (c++ code)

#include<iostream>
using namespace std;
#include<conio.h>
int main()
{
  int year;
 
  cout<<"Enter any year : ";
  cin>>year;
  if(year%4==0)
    cout<<year <<"is a leap year.",year;
  else
    cout<<year<<" is not a leap year.",year;
  getch();
  return 0;

  /*  Letuswithc:

       this page is designed to help you learn C or C++.
  Understandable C and C++ programming tutorials, compiler reviews, source code, tips and tricks. 
         */
 
}

No comments:

Post a Comment