Saturday 11 October 2014

C program to check leap year (using if-else and logical operator structure)

#include<stdio.h>
int main( void ){
int year = 2012;
if(( year % 4 == 0 && year % 100 != 0 ) || (year % 4 == 0 && year % 400 == 0 )){
      printf("Leap Year..\n");
}else{
      printf("Not Leap Year..\n");
}
return 0;
}

No comments:

Post a Comment