Question 13: According to the meteorological classification method, it is usually in the Gregorian calendar 3 ~ May is spring, 6 ~ August is summer, 9 ~ November is autumn, December ~ The year February is winter. Use swi

Source: Internet
Author: User

/*************************************** ************************
C Language

AUTHOR: liuyongshui
**************************************** ***********************/
/*
Question 13: According to the meteorological classification method, it is usually in the Gregorian calendar 3 ~ May is spring,
6 ~ August is summer, 9 ~ November is autumn, December ~ The year February is winter.
Use the switch structure to write a function to output the corresponding season Based on the month.

*/

# Include <stdio. h>

Void season (int m); // the original function season Declaration

Int main ()
{
Int month;

Printf ("Enter the month :");
Scanf ("% d", & month );

Season (month );

Return 0;
}


// Function Definition
Void season (int m)
{
Switch (m)
{
Case 3:
Case 4:
Case 5:
Printf ("the month % d you entered is in spring \ n", m );
Break;
Case 6:
Case 7:
Case 8:
Printf ("the month % d you entered is in summer \ n", m );
Break;
Case 9:
Case 10:
Case 11:
Printf ("the month % d you entered is in autumn \ n", m );
Break;
Case 12:
Case 1:
Case 2:
Printf ("the month % d you entered is in winter \ n", m );
Break;
Default:
Printf ("the number you entered is not in the month of 0 to 12! ");
}
}


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.