0 votes
116 views
in C programming by (98.9k points)
edited
C Program to Check Year is Leap Year or Not

1 Answer

0 votes
by (98.9k points)
selected by
 
Best answer
#include <stdio.h>
#include <conio.h>
 
int main(){
    int year;
    printf("Enter a year for leap year check\n");
    scanf("%d", &year);
    if(year%4 != 0){
        printf("%d is not a leap year\n", year);
    } else {   
        if(year%100 == 0){
            if ( year%400 == 0){
                printf("%d is a leap year\n", year);
            } else {
                printf("%d is not a leap year\n", year);
            }
        } else {
            printf("%d is a leap year\n", year );
        }
    }
    getch();
    return 0;
}

 

Related questions

0 votes
1 answer 103 views
0 votes
0 answers 65 views
0 votes
1 answer 130 views
0 votes
1 answer 146 views

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

535 users

...