//Leap Year count in C Programming
#include <stdio.h>
int main()
{
int year;
printf("Enter a year to check if it is a leap year:");
scanf("%d", &year);
if ( year%400 == 0)
printf("%d is a leap year.", year);
else if ( year%100 == 0)
printf("%d is not a leap year.", year);
else if ( year%4 == 0 )
printf("%d is a leap year.", year);
else
printf("%d is not a leap year.", year);
return 0;
}
Result :
#include <stdio.h>
int main()
{
int year;
printf("Enter a year to check if it is a leap year:");
scanf("%d", &year);
if ( year%400 == 0)
printf("%d is a leap year.", year);
else if ( year%100 == 0)
printf("%d is not a leap year.", year);
else if ( year%4 == 0 )
printf("%d is a leap year.", year);
else
printf("%d is not a leap year.", year);
return 0;
}
Result :
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন