Write a Program to accept days & convert it into equivalent no. of years, months, weeks & remaining days.

#include<stdio.h>
#include<conio.h>
 
void  main( )
{
  int  days ,yr,mn,wk,d;
printf("Enter the no of days");
scanf("%d",&days);
yr = days /365;
mn =(days /365)/30;
wk = (((days/365)%30)/7);
d =(((days/365)%30)%7);
printf("Years= %d \t Months=  %d \t Weeks =%d \t days = %d",yr,mn,wk,d);
getch();
 }

No comments:

Post a Comment

Related Post

Array:
String functions:
General (Loops-for/while)
Write a Program to print reverse of a given number Write a Program to print Product of Digits (eg. 212=2*1*2=4) of a given number Write a C++ Program to Convert Binary into Decimal Number