(Assume that each month is of 30 days) Example : Input - 69 Output - 69 days = 2 Month and 9 days */ classDayMonthDemo{ public static void main(String args[]){ int num = Integer.parseInt(args[0]); intdays = num%30; int month = num/30; System.out.println(num+" days = "+month+" Month and "+days+" days"); } }
You multiply the number of days you have by the number of seconds there are in a day, so: seconds = days * 24 * 60 * 60
DisplayMonth( int month ) //base 0 { switch( month ) { case 0: printf("January\n"); break; case 1: printf("February\n"); break; case 2: printf("March\n"); break; .... and so on } } enjoy
#define leap year void main() { enumeratedmonth{jan=1, feb, mar, april, may, june, july, aug, sept, oct, nov, dec} enumeratesd month month; int day,days,a month clrscr() printf("enter no.of month"); scanf("%d",& a month); switch(a month) { case jan: case mar: case may: case aug: case oct: case dec: printf(" no. of day=31"0; days=31; break; case april: case june: case sept: case nov: days=30; break; default; printf("wrong no."); day=0; } if (day!=0) printf("no. of days=%d/n",days); if (a month==feb) printf("29 if its a leap year"); getch(); }
#include<iostream> void num_to_years_weeks_days( unsigned num, unsigned& years, unsigned& weeks, unsigned& days) { years = num / 365; num -= years * 365; weeks = num / 7; num -= weeks * 7; days = num; } int main() { unsigned years, weeks, days; unsigned num = 1000; num_to_years_weeks_days(num, years, weeks, days); std::cout << num << " days is " << years << " years, " << weeks << " weeks and " << days << " days\n" << std::endl; num = 12345; std::cout << num << " days is " << years << " years, " << weeks << " weeks and " << days << " days\n" << std::endl; }
hmmm. . . string main () //NOTE you dont have to use the string main or return applepie = ) { int month, days; string month_name; // also if you have to configure the Year i would go by coppying the number of days //in each month by year and create a massive clause of if else trees by YEAR // for instance (int year 9) { days= 30; } } return applepie;
1400 hours = 1400/24 = 58.33... days. Given that a month can have 28 to 31 days, it is not possible to convert the number of days into an exact number of months but it is possible to say that it is a little short of 2 months.
1 month and 22,21,20 or 19 days depending on the month. But, taking a month to be 30 days, it would be 1 month and 20 days.
Divide the number of seconds by 86400 to convert to days. Then, divide the result by 30 to convert to months. The number of days per month is not very clearly defined; it really depends what month or months you are talking about, so you have to use an average, such as 30, or 30.5.
100 days is approximately equal to 3 months and 10 days. To convert days to months, you can divide the total number of days by the average number of days in a month, which is around 30.4. Therefore, 100 days divided by 30.4 days/month equals approximately 3.29 months.
There are approximately 2.6 months in 80 days. To calculate this, you can divide the total number of days by the average number of days in a month (30.4). This will give you an estimate of how many months are in 80 days.
There are 24 hours in any given day, so take the given number of hours and divide it by 24.
To convert days to months, we need to know the average number of days in a month. The average month has around 30.42 days. Dividing 121 days by 30.42 days/month gives us approximately 3.98 months. Therefore, 121 days is roughly equivalent to 3.98 months.
To convert 765 days into years, divide the number of days by the average number of days in a year, which is approximately 365.25 (accounting for leap years). This results in about 2.09 years. Therefore, 765 days is roughly 2 years and 1 month.
Unfortunately, "month" is not clearly defined - in the sense that different months can have a different length. The long-term average (for the number of days per month) is about 365.2422 / 12, or about 30.4. However, individual months can have anywhere between 28 and 31 days.You can: * Divide the number of hours by 24, to get the number of days. * Then, divide the number of days by 30.4 (or whatever value you choose to use for the month), go convert to months.
Write a C program called MonthDays to find the number of days in a given month Test your code with different input values to demonstrate that your function is robust?
Number of weeks = number of days in the month/7 .
To calculate the number of months and days in 138 weeks, we first convert the weeks into days by multiplying 138 weeks by 7 days/week, which equals 966 days. Next, we divide the total days by the average number of days in a month, which is approximately 30.4 days/month. This gives us roughly 31 months and 6 days in 138 weeks.