Created
April 26, 2021 17:31
-
-
Save btechmag/58bbb5cd25e5e92e7da50f8d846b4642 to your computer and use it in GitHub Desktop.
C Program to convert integer into years, months and days.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
//Program to convert integer into years, months and days | |
int days, months, years; | |
printf("Input days: "); | |
scanf("%d", &days); | |
years = days / 365; | |
months = (days % 365) / 30; | |
days = (days % 365) % 30; | |
printf("Years = %d\nMonths = %d\nDays = %d", years, months, days); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment