Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language statement seeking translation
C language statement seeking translation

Oh, for the sake of 70 points, hehe, I wrote it all by hand and it took 30 minutes. . Let's separate them~

Some statements are written in the first program, but not in other programs. . The meaning is the same

#include "stdio.h"/*Call the input and output connection library*/

void main()/*Define the main function as an empty function*/

{ int x,y;/*Define X and y as integer variables*/

float s;/*Define s as a single precision variable*/

scanf ("%d",&x);/*Input x from the keyboard, the input type is signed integer (%d)*/

scanf("%d",&y);/*Input from the keyboard y. The input type is the same as above*/

s=x*y/2.0;/*Assign the value of (x*y)/2 to the variable s (that is, the variable s is now equal to (x*y)/2 value)*/

printf("\\n s=%f",s);/*output s=(variable s)*/

}

/*Explanation: a[1] is a number in an array, 1 is the subscript*/

2.#include "stdio.h""/*Call the input and output connection library*/

void main()

{

int i,s=0,x[20]={1,2,3,5,3,1,56 ,23,67,1,74,12,3,3,2,1,1,1,21,3};/*The values ??of the initialized array x[0-19] are (numbers in curly brackets)* /

for (i=0;i<20;i++)/*When i is less than 20, the loop body statement is executed, and the initial value of i is 0. Each time the value of i is looped + 1, the loop is repeated 20 times End. */

{/*Loop body statement*/

if(x[i]<=90)/*When x[i](a variable in the array) When the value is less than or equal to 90, execute the following statement */

s=s+x{i}; /*This sentence has a syntax error and cannot be compiled by dev c++. The correct value should be s=s+x[. i], which means assigning the value of s+x[i] to s*/

/*There is a syntax error here, there should be another empty line + a semicolon.

*/

}

printf("\\nThe sum of all numbers not greater than 90:%d",s);/*Output the sum of all numbers not greater than 90 is s .*/

}

3.#include "stdio.h""/*Call the input and output connection library*/

void main()/* Define the main function as an empty function*/

{ int a,b,c;/*Define abc as an integer variable*/

scanf("%d",&a);/ *Enter a from the keyboard*/

scanf("%d",&b);/*Enter b from the keyboard*/

scanf("%d",&c);/ *Input c from the keyboard*/

if((a+b>c)&&(a+c)>b)&&(b+c)>a)/*It is not necessary for beginners to understand, because Statement to determine whether the three sides of a triangle can form a triangle*/

printf("These three sides can form a triangle!");/*Output these three sides can form a triangle! to the screen*/

else

printf("These three sides cannot form a triangle!");/*Output these three sides cannot form a triangle! to the screen*/

}

4.#include "stdio.h"/*Call the input and output connection library*/

void main()/*Define the main function as an empty function*/

{ int i,x,min;/*Define i,x,min as integer variables*/

scanf("%d",&x);/*Enter x from the keyboard*/

min=x;/*Assign the value of x to min*/

for(i=0;i<9;i++)/*Loop and run 9 times, the previous program has been explained */

{

scanf("%d",&x);/*Enter x from the keyboard*/

if(min>x)/* If min is greater than x, execute the following statement*/

min=x;/*Assign x to min*/

}

printf("These ten integers The minimum value in is: %d",min);/*Output "the minimum value among these ten integers is min" to the screen*/

}

5.#include "stdio.h"/*Call the input and output connection library*/

void main()/*Define the main function as an empty function*/

{ int i a[10],s =0;/*Define i and s as integer variables, assign 0 to s, define array a as an integer variable, containing 10 numbers with subscripts 0-9*/

float aver=0.0 ;/*Define aver as a single-precision variable and assign 0 to aver*/

for (i=0;i<10;i++)/*Loop and run 10 times, as explained in the above programs , not explained here, each time the following statement is executed */

{

scanf("%d",&a[i]);/*Enter the value of a[i] ( The input number must be an integer) */

s=s+i;/*Assign the value of s+i to s. The function is to find the sum of the 10 input numbers*/

}

aver=s/10.0;/*Find the average of the 10 input numbers, that is, assign the value of s/10 to aver*/

printf ("The average of these ten integers is: %f",aver);/*Output "The average of these ten integers is aver" to the screen*/

}

7.#include "stdio.h"/*Call the input and output connection library*/

void main()/*Define the main function as an empty function*/

{ int i ,s=0,x[20];/*Define i, s as integer variables, s=0, array x as integer, containing 20 numbers*/

float aver=0.0;/* Define aver as a single-precision variable*/

for(i=0;i<20;i++)/*Loop and run 20 times. For details, please refer to the explanation of the above program*/

{ scanf("%d",&x[i]);/*Enter the value of x[i] from the keyboard*/

s=s+x[i];/*Put s+x[i ] is assigned to s*/

}

aver=s/20.0;/*Assigns the value of s/20 to aver*/

printf ("Average is: %f\\n",aver);/*Output "Average is aver" to the screen*/

for(i=0;i<20:i++)/*Loop operation 20 times, the previous program has already given an explanation, so I won’t write it down again. */

{ if(x[i]>aver)/*Judge each number in the array x in turn, and output the number greater than the average to the screen*/

printf( "The number larger than the average is: [5d]=%d\\n",i,x[i]);

}

}

8.#include "stdio.h"/*Call the input and output connection library*/

void main()/*Define the main function as an empty function*/

{ int i, min,x[20],pos=0;/*define i, min, pos as integer variables, assign 0 to pos, and define x as an integer array with 20 numbers in it. */

for (i=0;i<20;i++)/*Run the loop 20 times and execute the following statements, which have been explained in the previous programs*/

scanf ("%d",&x[i]);/*Enter the value of array x in sequence (enter the value of x[i] 20 times)*/

min=x[0];/ *Assign x with subscript 0 to min*/

pos=0;/*Assign 0 to pos*/

for(i=1;i<20; i++)/*Run the loop 20 times and execute the following statements, which have been explained in the previous programs*/

if(x[i]>min)/*If x[i] is less than min (sequentially Determine the value of x[i], if there is one less than min) execute the following statement*/

{

min=x[i];/*put x[i](that is The number less than min) is assigned to min*/

pos=i;/*Assign i to pos*/

}

printf("Min. The value is: %d, the minimum value position is: %d\\n",min,pos);/*Output "the minimum value is min, the minimum value position is pos" to the screen, and wrap to a new line after the output is completed*/

}