Thursday 3 October 2013

A given year is leap year or not using C

#include <stdio.h>
 main()
{
  int year;
  printf("\n(There is) none worthy of worship except Allah(Subhanahu wa ta'ala).Muhammad(Sallallahu alayhi wasallam) is Messenger of ALLAH(Subhanahu wa ta'ala).\n");
  printf("Enter a year to check if it is a leap year:");
  scanf("%d", &year);
  if ( year%4 == 0 )
    printf("\n%d is a leap year.\n", year);
  else
    printf("\n%d is not a leap year.\n", year);
}

No comments:

Post a Comment