bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / semester_1 / letusc / lucproblem002.c

lucproblem002.c (485B)


      1 /* A year is entered through the keyboard, write a program to
      2 determine whether the year is leap or not. Use the logical operators
      3 && and || . */
      4 /* Let Us C, Chap - 4, Page - 64, Problem 4.1 */
      5 
      6 #include <stdio.h>
      7 int main()
      8 {
      9     int year;
     10     printf("Enter year : ");
     11     scanf("%d", &year);
     12     if (year % 4 == 0 && year & 100 != 0 || year % 400 == 0)
     13         printf("\nYear %d is a leapyear.", year);
     14     else
     15         printf("\nYear %d is not a leapyear.", year);
     16     return 0;
     17 }