answersLogoWhite

0

(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"); } }

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

How do you convert days to seconds in javascript?

You multiply the number of days you have by the number of seconds there are in a day, so: seconds = days * 24 * 60 * 60


How do you write a program to accept a month number and display a maximum number of days?

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


Write a c program to find number of days in a month using enumerated data types?

#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(); }


Write a C plus plus program to convert a given number into years weeks and days?

#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; }


C programming to display a calendar?

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;

Related Questions

How many month is 1400 hours?

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.


50 days convert into how many month and days?

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.


How many months in 5 trillion seconds?

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.


How many months is 100 days?

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.


How many months is in 80 days?

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.


How do you convert hours to day?

There are 24 hours in any given day, so take the given number of hours and divide it by 24.


How many months is 121 days?

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.


How many years in 765 days?

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.


How many months is 911 hours?

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?

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?


How do you calculate weeks in a month?

Number of weeks = number of days in the month/7 .


How many months and days is 138 weeks?

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.