C calendar Program to display day to inputs of year, month and day

C calendar Program to display the name of day to the inputs of year, month and day

This page has a C Program to display (print) Name of Day of week and Date of calendar for any year, month and day as given. The viewers of this calendar program have to give only year, month and day as inputs to display calendar date and Name of Day of week with respect to the Normal calendar.  For example:  if we  give  the inputs as the calendar year is 2016, Month is 8, and day is 21 then this calendar program will display the output as The Date Given is : 21/08/2016 and Day of Week of the Date : SundayThe below given C program will display (print) Name of Day of week and Date of calendar for any year, month and day.  Kindly check out the program to display (print) Name of Day of week and Date of calendar.  The  Question for calendar program may be as   1). How to make a Calendar by C program  2). How to write program in C for calendar  3). program to Make or print name of calendar date for any day  4). How to make Calendar in C program  5). C Program to Implement Calender Program to display Day.

display (print) Name of Day of week and Date calendar Program


    #include<stdio.h>
    #include<conio.h>
    #include<math.h>
    int main(){
                  int dat, mont, years;
                  printf("Enter the year : ");
                  scanf("%d", &years);
                  printf("\n Enter the month : ");
                  scanf("%d", &mont);
                  printf("\n Enter the date : ");
                  scanf("%d", &dat);
                  weekday(dat, mont, years);
                  return 0;
                  }
    int weekday(int date, int month, int year) {
           int dayWeek, yr, yd;
           yr = year % 100;
           yd = year / 100;
           printf("\nThe Date Given is : %d / %d / %d \n\n", date, month, year);
           dayWeek = 1.25 * yr + findm(month, year) + date - 2 * (yd % 4);
           dayWeek = dayWeek % 7;
           switch (dayWeek){
           case 0:  printf("Day of Week of the Date is : Saturday");
                        break;
           case 1:  printf("Day of Week of the Date is : Sunday");
                        break;
           case 2:  printf("Day of Week of the Date is : Monday");
                        break;
           case 3:  printf("Day of Week of the Date is : Tuesday");
                        break;
           case 4:  printf("Day of Week of the Date is : Wednesday");
                        break;
           case 5:  printf("Day of Week of the Date is : Thursday");
                        break;
           case 6:  printf("Day of Week of the Date is : Friday");
                        break;
           default:  printf("The Given input data is wrong");
           }
           return 0;
           }
    int findm(int months, int yearss){
           int findmonth, leapyr;
           if ((yearss % 100 == 0) && (yearss % 400 != 0))
           leapyr = 0;
           else if (yearss % 4 == 0)
           leapyr = 1;
           else
           leapyr = 0;
           findmonth = 3 + (2 - leapyr) * ((months + 2) / (2 * months))
+ (5 * months + months / 9) / 2;
           findmonth = findmonth % 7;
           return findmonth;
    }

  


Sample Output:

                  Enter the year :  : 2016

                  Enter the month : 8

                  Enter the date : 19

                  The Date Given is : 19/08/2016 

                   Day of Week of the Date : Friday

Other Related C Programs :


* C Program to find whether the given number is Odd or Even

* C Program to find the Sum of Odd Digits

* C Program to find the Sum of Even Digits

* C Program to find the Sum of Even and Odd Digits,

* C Program to Display Odd digits

* C Program to Display even digits

* C Program to Display Odd Numbers,

* C Program to Display Even Numbers,

* C Program to Check whether the given number is Armstrong number

* C Program to display the Armstrong numbers in Range

* C Program to display the Armstrong numbers between 1 and 1000

* C Program to check perfect number, perfect numbers in range

* C Program to Check Prime number, Prime numbers between 1 and 100

* C Program to display the Prime numbers in a Range

* C Program to display the Sum of Prime numbers

* C Program to Check Strong number

* C Program to display the Strong number in Range

* C Program to Check whether the given number is polindrome number or not

* C Program to Check polindrome number using for loop

* C Program to Check polindrome number using Recursion

* C Program to  check whether the given string is polindrome or not

* C Program to find the Roots of Quadratic equation

* C Program to display Fibonacci Series

* C Program to display the Fibonacci Series using an array

* C Program to display the Fibonacci Series using while loop

* C Program to find the Sum of Fibonacci Series, Factorial of Number

* C Program to find the Factorial without using Recursion

* C Program to find the Factorial using Pointers

* C Program to find the Factorial using Function

C calendar Program to display day to inputs of year, month and day

The C calendar Program to display the name of day with respect to the given inputs of year, month and day. It is clear that, the calendar Program included in the page has two user defined function to find day of week and the respective month. The calendar Program in C is very useful  to the viewers whoever have being studying in schools and colleges. The calendar Program is written in C language and so that the viewers whoever being viewing and learning this calendar Program can understand well.

Bookmark and Share