A C program to print all leap years from 1 to N

// A C program to print all leap years from 1 to N

#include <stdio.h>
#include <conio.h>
void main()
{clrscr();
int year, y;   
printf("\nEnter Years : ");
scanf("%d",&year);
printf("\nThe Leap years are : ");
for( y = 1 ; y <= year ; y++ ){
if((y % 400 == 0 )|| ((y % 4 == 0)&& (y %100 != 0)))
printf("\n Year : %d",y);
}}
getch();
}

Output:


A C program to print all leap years from 1 to N, my knowledge to you dude


















Nhận xét