Wednesday, 12 October 2016

HHW Q5. WAP to check whether an entered year is leap or not .

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
cout<<"Enter the year ";
cin>>a;
if (a%400==0)
   { cout<<"This year is not a leap year ";              /*Century years divisible by 400 are not leap year*/
   }
else
   { if (a%4==0)
{cout<<"This year is leap year ";
}
     else
{cout<<"This year is not a leap year ";
}
   }
getch();
}

No comments:

Post a Comment

Basic Implementation of Array as a Pointer

#include<iostream.h> #include<conio.h> void main() { clrscr();   int arr[5];   cout<<"Enter 5 nos. ";   f...