Saturday, 1 February 2014

Filled Under:

write a program in c++ that calculate leap year

Example 4 if,else statement:

logic:
         here the main logic is that "the year which will divide by 4 and reminder is zero then the year will be leap otherwise not" so we take the modules of year by and check the year is leap or not.

program:

#include "stdafx.h"
#include "iostream"
#include "conio.h"
using namespace std;
void main()
{
int year;
cout<<"enter the year==";
cin>>year;
if(year%4==0)
cout<<"leap year";
else
cout<<"not a leap year";
_getch();

}

                                                                DOWNLOAD .CPP FILE






0 comments:

Post a Comment