Q:

C program to convert Total days to year, month and days

0

Write a C program to convert Total days to year, month and days. Here’s simple program to convert Total days to year, month and days in C Programming Language.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Below is the source code for C program to convert Total days to years, month and days which is successfully compiled and run on Windows System to produce desired output as shown below :

SOURCE CODE : :

/*  C program to convert Total days to year, month and days  */

#include <stdio.h>

int main(void)
{
    int d,y,m,nd;
    printf("Enter number of days :: ");
    scanf("%d",&d);
    y=d/365;
    d=d%365;
    m=d/30;
    nd=d%30;
    printf("\n%d years, %d months, %d days\n",y,m,nd);
    return 0;
}

 

OUTPUT : :

Enter number of days :: 560

1 years, 6 months, 15 days

 

Above is the source code for program to convert Total days to year, month and days which is successfully compiled and run on Windows System.The Output of the program is shown above .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Basic Solved Programs – C Programming

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a C program to find Sum and Average of two n... >>
<< Write a C Program to calculate simple interest...