C Language Programming seventh time job

Source: Internet
Author: User
Tags function prototype greatest common divisor

I. Contents of the study

This lesson learned the basic knowledge of the function, we need to summarize the following knowledge points:

1. What is the difference between the basic format of the function definition, the function definition, and the function prototype (declaration)?

2. What are the methods of calling functions?

3. What are formal parameters, what are arguments, and what is the parameter passing mechanism when a function call is called?

Ii. contents of the experiment

1. Define a function isprime (int n) that determines the primenumber,using the function to output all the prime numbers within a range of ten, each line , and the final output of how many primes. (aligned per column)

2. Find the greatest common divisor and least common multiple of two positive integers. Using a function gcd (int a,int b) for greatest common divisor, the other function lcm (int a,int b) is greatest common divisor based on the least common multiple obtained.

3. Write a function fun (double x) to evaluate the value of the expression x2-5x+4, and X to pass as a parameter to the function. Call the function in the main function to evaluate the following values:

y1= 22-5*2+4

Y2= (x+15) 2-5* (x+15) +4

y3= sin2x-5*sinx+4

Beg Y3 using the math function sin (x) header File Math.h

solving y2 and Y3 you need to enter X the value.

Examples:

y1=-2, x=0.5 when the y2=166.75,y3=1.832721

4. Use the function to achieve: match stick equation problem.

Additional Questions

The function realizes the perpetual calendar, where you need to define the following functions

int isvalidate (int year,int month)//validation of input data legality
int isleap (int year)//Judgment leap Year
int days (int year,int month)//calculate the number of months in a certain year
int totaldays (int year,int month)//calculates the total number of days from month to January 1, 1900 for a certain year
void Printcanlender (int year,int month)//output Perpetual calendar

Third, the experimental requirements

Job submissions must be written in the following format, not just the source code, or only the running results.

The format is as follows:

First, the contents of the experiment

    1. Experimental requirements: XXXXXXXXX

Code: (Use the Blog park's insert code function to insert the source code, do not, strictly in accordance with the standard format to write, learning to add the necessary comments )

Program Run Result:

Each experimental question is completed in the format described above.

Ii. Summary of Knowledge points

1 、.......

2 、.......

........

Third, the experimental summary (the problems encountered in the experiment and solutions)

1 、.......

2 、.......

........

Iv. Assessment of Operations:

Out of 10, of which the program writing specification (indentation) and the results of the correct 5 points, the program is not standard deduction 1 points, the Knowledge Point Summary 2 points of the experiment summarized 2 points, each class submitted the first 5 students 1 points. Bonus points: 1 points for homework review, 1 points for additional questions

Late hand assignment 0 points, a week later still did not hand in the work, 10 points upside down, found plagiarism, all the upside down 10 points. The grading of the work will be the main basis for the results and results of the final grade.

C Language Programming seventh time job

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.