C Program to Convert Days to Years Weeks and Days

In this tutorial you will learn about the C Program to Convert Days to Years Weeks and Days and its application with practical example.

C Program to Convert Days to Years, Weeks, and Days

In this tutorial, we will learn to create a C program that will Convert Days to Years Weeks, and Days using C programming.

Prerequisites

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

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • Conditional Statements in C programming.
  • Arithmetic operations in C Programming.

Algorithm:-

Find the Day Name of a Week:-

In today’s program, we will take the input number of days from the user. Then we will pass that variable to the mathematical expressions to find the number of weeks and years. At last, we will print the resulting years and the weeks to the user.

With the help of the below program, we can convert days to weeks and years.

Program Code:-

 

Output:-

In the above program, we have first initialized the required variable.

  • days = it will hold the integer value for the input.
  • years = it will hold the integer value.
  • weeks = it will hold the integer value.

Taking the input day from the user.

Converting the days to years.

Printing output.

In this tutorial we have learn about the C Program to Convert Days to Years Weeks and Days and its application with practical example. I hope you will like this tutorial.