-->
Showing posts with label total days into year. Show all posts
Showing posts with label total days into year. Show all posts

program to convert days into year ,month and days

// program to convert total days into year,month and days #include<stdio.h> #include<conio.h> void main() { clrscr(); int total_days,year,month,days; printf("enter total days \n"); scanf("%d",&total_days); year=total_days/365; // to get year after dividing total days by 365 printf("year =%d\n",year); year=total_days%365; // after getting years, we have to get total left days month=year/30; // to get total months printf("total months=%d\n",month); days=year%30; // it gives total left days as days after getting months printf("the days=%d\n",days); getch(); }

note:
Here I have used same variable again and again. But I you want then you can use different variable.