Advertisement
tonygms3

Question 3 Assignment

Dec 20th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int year;
  5.    while(1){
  6.     printf("Enter a year to check if its Leap year or not\n");
  7.     printf("Press 0 to exit the program\n");
  8.     scanf("%d",&year);
  9.     if(year==0)
  10.     {
  11.         break;
  12.     }
  13.     else if(year%4==0)
  14.     {
  15.         printf("%d is a leap year\n",year);
  16.  
  17.     }
  18.     else
  19.     {
  20.         printf("%d is not a leap year\n",year);
  21.     }
  22.    }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement