C Language Blog Job--function

Source: Internet
Author: User
Tags define function pow

First, the PTA laboratory work Problem 1:6-3 use function to determine the total square number 1. PTA Submission List

2. Design Ideas
    • 1. Define function int Issquare (int a)
    • 2. If sqrt (a) is an integer returning 1, return 0

      3. Problems encountered in commissioning process and PTA submission List status note

      At first I defined a new variable n, if sqrt (a) ==n, returns 1, otherwise returns 0, which is always yes, partially correct. Solve the problem by using (int) to represent the whole number after you finish the lesson

      Topic 2:6-6 Use the function to output daffodils number 1. PTA Submission List

2. Design Ideas
    • 1. Define function int narcissistic (int number)
    • 2. Defining integer Variables J=1,sum=0,num,n=0,k
    • 3.num=number
    • 4.num=num/10,n++, until num!. =0
    • 5.k=number/pow (10,j-1), Sum=sum+pow (K%10,n), J + +
    • 6. Repeat step 5 until j<=n
    • 7. If sum==number, return 1; return 0
    • 8. Define function void Printn (int m, int n)
    • 9. Define I
    • 10.m=m+1;i=narcissistic (M), if i=1, Output m
    • 11. Repeat step 10 until the M<n

      3. Problems encountered in commissioning process and PTA submission List status note

      In the PRINTN function, the initial value of M is not assigned, the narcissistic function in the POW function 10 of the j-1 is just beginning to write 10 J-Square

      The topic 3:7-1 the combination number 1. PTA Submission List

2. Design Ideas
    • 1. Define M,n
    • 2. Enter M,n
    • 3. Output result
    • 4. Defining a function double fact (int m,int N)
    • 5. Defining integer Variables I,j,k,l,sum1=1,sum2=1,sum3=1,sum4=1
    • 6. Define floating-point variable sum
    • 7.i=1,sum1=sum1*i,i++
    • 8. Repeat step 7 until the I<=m,l<=n
    • 9.j=1,sum2=sum2*j,j++;
    • 10. Repeat step 9 until the J<=n
    • 11.k=1,sum3=sum3*k,k++
    • 12. Repeat step 11 until the K<=n-m
    • 13.l=n/2+1,sum4=sum4*l,l++
    • 14. Repeat step 13 until the L<=n
    • 15.sum=sum2/(SUM1*SUM3)
    • 16. If M=N/2,SUM=SUM4/SUM1
    • 17 Return sum

      3. Problems encountered in commissioning process and PTA submission List status note

      Without considering M=N/2, sum=sum2/(SUM1*SUM3) has just begun without parentheses

      Second, peer code pairs of peer review 1. Peer Reviews Photos

2. My Code, mutual evaluation of the student code

My Code
Wang Hongyue's Code

3. Where do I differ from my classmates ' code? What are the advantages? What style of code do you prefer? If the classmate code is wrong, please help to point out where the problem

Wang Hongyue only one cycle can be achieved, I used 4 cycles, low efficiency. I prefer the Wang Hongyue code.

Third, this week's topic set PTA Final Ranking

Iv. Study Summary of the Week 1. What did you learn?

Integer, character, floating-point three data types. The value of a character variable can be an integer
It can also be a character. ++,--, such as single-mesh operators. First, the logical operator! Again arithmetic operation again
Relational operator re-logical operator &&| | The value of the re-assignment operator.

2. This week's content, you are not what?

Small knowledge points too much, more trivial, remember not prison, need to repeat memory

3. Circular Structure Examination Summary

This exam, I only wrote the first two questions, the third problem of the judgment of the prime number of a half-day, the binary card has been a long time.
I am not satisfied with the total score of more than 30 points, but this also can be seen in my study attitude, the cycle structure began,
The topic will become difficult, but my attitude is still not correct, always love lazy. Still need to spend more time on study.

C Language Blog Job--function

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.