C Language First time job

Source: Internet
Author: User

First,PTA Laboratory Work

Topic 1. Temperature conversion

The subject requires a program to calculate the Celsius temperature of Fahrenheit 150°f. Calculation formula: c=5x (F?32)/9, in the formula: C is the Celsius temperature, F is Fahrenheit temperature, the output data requirements for the integer type.

1. Code

... int Celsius,fahr;fahr=5* (fahr-)/9;p rintf ("  Fahr = Celsius =%d\n", Celsius);

2. Design Ideas

(1) Define the variable Fahr temperature, celsius Celsius temperature.

(2) Input f=150

(3) Input formula calculation.

(4) End the procedure.

3. Debugging Issues

The interval at the equals sign is not taken, resulting in the submission of multiple prompt errors.

Topic 2. Is it too fat?

It is said that a person's standard weight should be his height (in centimeters) minus 100, and then multiplied by 0.9 of the number of kilograms. The known Jin is twice times the kilogram. Given a person's height, would you please calculate what the standard weight should be? (By the way also quietly calculate for yourself ...) )

1. Code

int h;  ();   Double weight;  scanf ("%d",&h);  Weight= (h-N) *0.9;  printf ("%.1f", weight*2);  ...  

2. Design Ideas

(1) The definition of height as shaping variable h, the weight of floating-point type to determine the range of 100~300.

(2) Input function H.

(3) The relationship between height and weight weight= (h-100) *0.9, then the unit conversion between Jin and kilogram. The algorithm is written accordingly.

(4) End the program and output the standard weight.

3. Debugging Issues

1. Initially, the weight was defined as a floating-point type, and the correction was later discovered through inspection.

2. Mistake the meaning of the topic, when writing the WEIGHT/2, resulting in the test program output results and the answer is not the same.

# #题目3. Output figures

Given a three-bit positive integer, output its hundred, 10-digit, and single digit numbers.

1. Code

... int A;  scanf ("%d",&a);  printf ("%d,%d,%d", A/A, (a) ofTen,a%  (Ten)  ; return 0 ;...

2. Design Ideas

(1) Define an integral type of data a.

(2) Enter the previously defined integer A.

(3) Use a/100, (A/10)%10,a%10 to find the hundred numbers, 10 digits, single digits.

(4) End the procedure.

3. Debugging Issues

No problems encountered.

# #题目4. Integer arithmetic

The subject requires a program to calculate 2 positive integers of the and, difference, product, quotient and output. The title guarantees that the inputs and outputs are all within the integer range.

1. Code

...intb; scanf ("%d%d",&a,&b); printf ("%d +%d =%d\n", A,b,a +b); printf ("%d-%d =%d\n", A,b,a-b); printf ("%d *%d =%d\n", A,b,a *b); printf ("%d/%d =%d", A,b,a/b); ..

2. Design Ideas

(1) Define two shaping variables to be a, B.

(2) Enter these two variables.

(3) Design algorithm to find the and, difference, product, quotient.

(4) End the procedure and draw the result.

3. Debugging Issues

1. Forget to add a line break at first.

Second, this week's topic set PTA Submission List and the final ranking .

PTA Submission List

PTA Rankings

iii. Summary of this week's study

1. What have you learned?

Learn the basic programming, know the C language of some data types and usage, will use the If-else statement to write a simple algorithm, in addition, also learned the programming of some complex mathematical symbols of the call and so on.

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

The knowledge learned this week has been largely mastered.

3. What difficulties do you encounter and how do you plan to solve them?

This week is not too difficult, is the speed of writing code is too slow, not skilled, writing programming is very careless, always make some basic mistakes, such as some punctuation errors. I intend to practice more, beat the yards, and try to avoid making the same mistakes.

C Language First time job

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.