Skip to content

Instantly share code, notes, and snippets.

@btechmag
Created April 26, 2021 17:31
Show Gist options
  • Save btechmag/58bbb5cd25e5e92e7da50f8d846b4642 to your computer and use it in GitHub Desktop.
Save btechmag/58bbb5cd25e5e92e7da50f8d846b4642 to your computer and use it in GitHub Desktop.
C Program to convert integer into years, months and days.
#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