• Write a Cpp program to check whether a given year is leap or not:

     Write a C++ program to check whether a given year is leap or not:

    1. For century year if the given year is completely divided by 400 means reminder will  be zero .
    2. For non century year if it is is not completely divided by 100 and completely divided by 4.

            Coding:
           #include <iostream>
           using namespace std;
           int main(){ 
            int year;
         cout<<"Enter a year: "<<endl;

        cin>>year;
        if(year%400==0 || year%100!=0 && year%4==0){
            cout<<"This is leap year"<<endl;
        }
        else{
            cout<<"This is not leap year"<<endl;
        }

    return 0;

  • 0 comments:

    Post a Comment

    GET A FREE QUOTE NOW

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

    Search This Blog

    Powered by Blogger.

    Blog Archive

    ADDRESS

    Peshawar Pakistan

    EMAIL

    hk2456632@mail.com

    WhatsApp Number

    +92 3335590608