C program to convert days into years, weeks and days

In this tutorial you will learn about the C program to convert days into years, weeks and days and its application with practical example.

In this tutorial, we will learn to create a C program that will accept year, month and date form user  and display of the day  using C programming.

Table Of Contents

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following C programming topics:

  • C Operators.
  • Basic input/output.
  • C loop statements
  • C switch case.
  • Function in C.

Example:

If you give value input in particular format  like year=2021, Month=5, and day is 12 then this  program will display the output as The Given  Date is : 12/05/2021 and Day of Week of the Date : Wednesday.

C Program to Display Day of the month.

In this program we  will print name of the Day of week and Date of calendar for given year, month and day.  Please  check out the program below  to  print, Name of Day of week and Date of calendar.

Output

 

In the above program, we have first declared and initialized a set variables required in the program.

This program will accept three values from user Year,Month and Date.Then we passes all three value to function called week_day it will accept all three values.With the help or week_day() function we calculate month day and week day.Within this function we gain called a function findmonth(). we find the month value and returns the value to week_day()  function where we will find the day of week and print our required output.

 

 

In this tutorial we have learn about the C program to convert days into years, weeks and days and its application with practical example. I hope you will like this tutorial.