Difference between revisions of "Days in a Month"

From CompSciWiki
Jump to: navigation, search
 
Line 2: Line 2:
  
 
|Problem=Create a program that allows the user to enter a month, and then outputs the number of days in that month.  For simplicity sake, ask the user for the number of the month rather than the string.  Also, assume there are 28 days in February.
 
|Problem=Create a program that allows the user to enter a month, and then outputs the number of days in that month.  For simplicity sake, ask the user for the number of the month rather than the string.  Also, assume there are 28 days in February.
 +
  
 
For example, if they want to know how many days there are in the month of January, the user would enter the number 1 and receive an answer of 31.
 
For example, if they want to know how many days there are in the month of January, the user would enter the number 1 and receive an answer of 31.
 
 
Input: 1
 
  
 
|SideSection=
 
|SideSection=

Revision as of 15:40, 2 April 2010

Back to the Program-A-Day homepage

Problem

Create a program that allows the user to enter a month, and then outputs the number of days in that month. For simplicity sake, ask the user for the number of the month rather than the string. Also, assume there are 28 days in February.


For example, if they want to know how many days there are in the month of January, the user would enter the number 1 and receive an answer of 31.

 

SideSectionTitle

float
Taken from http://www.flickr.com/photos/daniello/565304023/

An image or By Students section

Solution

Code

SolutionCode goes here. Please DO NOT put your code in <pre> tags!

Back to the Program-A-Day homepage