#include <stdio.h>
printf("Enter the number of days: \n");
scanf("%d" , &no_of_days); //taking input in form of days
years = no_of_days / 365; //extracting years
#include<conio.h>
#define daysinaweek 7
void main()
{
#define daysinaweek 7
void main()
{
int no_of_days, days, weeks, years; // required variables
clrscr(); //clearing the console screen
printf("Enter the number of days: \n");
scanf("%d" , &no_of_days); //taking input in form of days
years = no_of_days / 365; //extracting years
weeks = (no_of_days % 365) / daysinaweek ; // extracting weeks
days = (no_of_days % 365) % daysinaweek ; // remaining days
//Output required
printf ("%d is equivalent to %d years, %d weeks and %d days\n", no_of_days, years, weeks, days);
}
days = (no_of_days % 365) % daysinaweek ; // remaining days
//Output required
printf ("%d is equivalent to %d years, %d weeks and %d days\n", no_of_days, years, weeks, days);
}
No comments:
Post a Comment