C language I - assignment 06

Which course does this assignment belong tohttps://bbs.csdn.net/forums/csuft_swxy_C?category=0&typeId=17321
What are the requirements for this assignmenthttps://bbs.csdn.net/topics/603427602
The goal of this assignmentLearning cycle
Student number20218540

1, Homework this week (40 points in total)

1.1 complete PTA homework and give a screenshot of programming questions. The screenshot has its own student number and name identification (0 point if it is not in the form of screenshot) (5 points for each question)

***

1. Learning progress bar (5 points)

2 accumulated code lines and blog words (5 points)

3. Learning content summary and perception (5 points)

2, Job format

1. PTA operation

1.1 (title):

1.1.1 map display code, do not copy or take photos, such as (remember student number + name, not in this picture, but in your homework!)

1.1.2 data processing

Introduce how you do your data expression and data processing in the process of realizing this problem.

1.1.3 PTA submission list and description

According to the PTA submission list, briefly describe the problems encountered in the commissioning program and solutions. For example:

7-1 find the sum of the first N items of the interleaved sequence (15 points)
: this problem requires writing a program to calculate the sum of the first N items of the staggered sequence 1-2 / 3 + 3 / 5-4 / 7 + 5 / 9-6 / 11 +.

Input format:

The input gives a positive integer N in one line.

Output format:

Output the value of partial sum in one line, and keep the result to three decimal places.

Input example:

5

Output example:

0.917


Data representation: variables are x,y,N,s,n. All calculated, x,y,N by int Type, s,n by double type
 Data processing: assignment, calculation, cycle, output.
Error reason: the output format is wrong and it is written as"n=%.3f\n"

7-2 sum of the first N items of the square root sequence (15 points)

This problem requires writing a program to calculate the square root sequence

Sum of the first N items of. You can include the header file math.h and call the sqrt function to find the square root.

Input format:

The input gives a positive integer N in one line.

Output format:

In one line, output the value S of the partial sum in the format of "sum = S", accurate to two decimal places. Ensure that the calculation results do not exceed the double precision range.

Input example:

10

Output example:

sum=22.47


Data representation: variables are N,n,sum. n,sum Is calculated, N From the assignment, n,N by int Type, sum by double type
 Data processing: assignment, calculation, cycle, output.
Error reason: sum = %.2lf There is no space on either side of the equals sign

7-3 change coins (20 cents)

Change a sum of change into 5 cents, 2 cents and 1 cent coins. Each coin is required to have at least one. How many different ways can you change it?

Input format:

Enter the amount of change x ∈ (8100) given in one line.

Output format:

It is required to output various exchange methods in the order of large to small according to the number of nickels, nickels and nickels. One conversion method is output for each line, and the format is: "fen5: number of nickels, fen2: number of nickels, Fen1: number of nickels, total: total number of coins". The last line outputs "count = number of conversions".

Input example:

13

Output example:

fen5:2, fen2:1, fen1:1, total:4
fen5:1, fen2:3, fen1:2, total:6
fen5:1, fen2:2, fen1:4, total:7
fen5:1, fen2:1, fen1:6, total:8
count = 4


Data representation: variables are x,y,count,n,m. n,m,y,count Is calculated, x Obtained by assignment, all are int type
 Data processing: assignment, calculation, cycle, output.
Error reason: no line feed

7-4 sum of exponentiation (15 points)

This problem requires the preparation of programs and calculation

You can call the pow function to find the power.

Input format:

The input gives a positive integer n (≤ 10) in one line.

Output format:

Output in the format "result = calculation result".

Input example:

5

Output example:

result=63


Data representation: variables are result,sum,n,i. result,sum,i Is calculated, n Obtained by assignment, all are int type
 Data processing: assignment, calculation, cycle, output.
Error reason: the output result is written as"result=%d",result

7-5 print the 99 formula table (15 points) the following is a complete 99 formula table of the lower triangle:

1*1=1   
1*2=2   2*2=4   
1*3=3   2*3=6   3*3=9   
1*4=4   2*4=8   3*4=12  4*4=16  
1*5=5   2*5=10  3*5=15  4*5=20  5*5=25  
1*6=6   2*6=12  3*6=18  4*6=24  5*6=30  6*6=36  
1*7=7   2*7=14  3*7=21  4*7=28  5*7=35  6*7=42  7*7=49  
1*8=8   2*8=16  3*8=24  4*8=32  5*8=40  6*8=48  7*8=56  8*8=64  
1*9=9   2*9=18  3*9=27  4*9=36  5*9=45  6*9=54  7*9=63  8*9=72  9*9=81  

This problem requires that a partial formula table from 11 to NN be output for any given positive integer N.

Input format:

The input gives a positive integer N (1 ≤ N ≤ 9) in one line.

Output format:

Output the lower triangle N*N part formula table, in which the number on the right of the equal sign occupies 4 digits and is aligned on the left.

Input example:

4

Output format:

1*1=1   
1*2=2   2*2=4   
1*3=3   2*3=6   3*3=9   
1*4=4   2*4=8   3*4=12  4*4=16  


2.1 Learning progress bar (5 points), all int type
 Data processing: assignment, calculation, cycle, output.
Error reason: if The content of is not written correctly

***

2.1 learning progress bar (5 points)

Week \ dateTime spent this weekCode lineIntroduction to knowledge points learnedAt present, there are some confused problems
11.15-11.2110h450while, for, etc. can express the use of loopsnothing

2.2 cumulative code lines and blog words

2.3 learning perception

study hard and make progress every day!

Tags: Python C Algorithm

Posted on Mon, 22 Nov 2021 17:46:30 -0500 by isam4m