Recent Posts

9-latest-250px-course

Write a C program to find the number of days in a given month of a given year

Write a C program to find the number of days in a given month of a given year



Program:-     

#include<stdio.h>
int main()
{
    //fill the code
    int year, month;
    scanf("%d %d",&month,&year);
    if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
        printf("Number of days is 31");
    else if((month == 2) && ((year%400==0) || (year%4==0 && year%100!=0)))
    {
        printf("Number of days is 29");
    }
    else if(month == 2)
    {
        printf("Number of days is 28");
    }
    else
        printf("Number of days is 30");
    return 0;
}

Output:-

....
SHARE

Milan Tomic

Hi. I’m Designer of Blog Magic. I’m CEO/Founder of ThemeXpose. I’m Creative Art Director, Web Designer, UI/UX Designer, Interaction Designer, Industrial Designer, Web Developer, Business Enthusiast, StartUp Enthusiast, Speaker, Writer and Photographer. Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment