answersLogoWhite

0


Best Answer

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

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

#include

#include

main()

{

int dd,mm,yy,odday,n,ly,ny,i;

int a[12]={3,0,3,2,3,2,3,3,2,3,2,3};/* odd days according to months in a year

clrscr();

printf("Enter a date in DD/MM/YY format

");

printf("DATE: ");

scanf("%d",&dd);

printf("MONTH: ");

scanf("%d",&mm);

printf("YEAR: ");

scanf("%d",&yy);

printf("Day ON %d / %d / %d is : ",dd,mm,yy);

n=((yy-1)%400);

ly=n/4;

ny= n-ly;

odday=(ly*2)+ny;

if(yy%4==0)

{

a[2]=1;

}

for(i=1;i

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Using standing input techniques of the language, get the month number as a number (and not a string) and check it is an integer in the required range. Then to convert it to number of days, either use a look up table or a formula on the month number. Finally use the standard output techniques of the language to display the result.

Of course, with the given input, the program will have a problem with February as it may have 28 or 29 days depending upon whether it is a leap year or not and no year is requested for consideration.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

Design a program that asks the user to enter the number of books that he or she has purchased last month and display the number of points awarded?

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

with a computer.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

march

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a program to accept a month number and display a maximum number of days?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a program in COBOL to find the largest of N number?

identification division. program-id. greatest. environment division. data division. working-storage section. 77 a pic 999. 77 b pic 999. 77 c pic 999. procedure division. greatest. display "ENTER THE THREE NUMBERS:". accept a. accept b. accept c. if a > b and a > c display a "is greatest" else if b > c display b "is greatest" else display c "is greatest". display " thank you". stop run.


Draw a flowchart to accept 3 numbers and display the largest number?

draw a flowchart to display the first tenth even number


Write a program which takes any number of days from the user the program should display the number of years number of months formed by these days as well as the remaining days?

Write a program which takes any number of days from the user. the program should display the number of years, number of months formed by these days as well as the remaining days.


What is the maximum number of pages that the print preview option can display at a time?

20


Draw a flow chart to accept a number from 1 to 7 and display the corresponding day of the week?

no


Write a program to display the name of days when a user enters a number?

write a program to display your name age class schoolname e-mail 2hobby based on choice


How do you write the pseudo codes that will accept 7 numbers and display their sum?

Start accept 7 number calculate sum print sum stop


What function enables the user to input information while the program is being executed in c?

The scanf() function is a commonly used function to input information during the execution of a program. scanf() function has its prototype in the stdio.h header file. To accept and display a number: int num; printf("Enter a number: "); scanf("%d",&num); printf("You entered %d",num); To accept and display a character, replace %d with %c and make num a character variable [char]. Plus: gets, fgets, read, fread, getchar, getc, fgetc, getch...


Write a c program using while loop to accept a number check and display message whether number is perfect or not?

The program is here guys.......... //Finding whether the given number is perfect or not //Starts here #include<stdio.h> void main() { int i=1,temp=0,number; scanf("%d",&number); while(i<=number/2){ if(number%i==0) temp+=i; i++; } if(temp==number) printf("Its a perfect number"); else printf("Its not a perfect number"); } //ends here


Write a c program to accept a numbers and generate square root cube and exponential values?

write a c program to accept a number and generate a square root cube and exponential values


Make a program that will accept any number n between 20-50 and another number x between 1-5 Then the program will display all numbers from 1-n that is divisible by x?

/* a number divisible by x should be a multiple of x */ int i, n,x; scanf ("%d", &n); scanf ("%d",&x); for(i=x;i =< n;i+=x) { printf ("%d", x); }


Write a program in shell script to display odd number from 0 to 100?

seq 1 2 99