Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - C language (with the simplest, beginners) from the keyboard input four integers, the average. Data input, calculation results and output need comments.
C language (with the simplest, beginners) from the keyboard input four integers, the average. Data input, calculation results and output need comments.
# include & ltstdio.h & gt// contains standard input and output libraries.

Int main()// main function declaration

{

Int a, b, c, d, sum// define four variables to receive four integers, and sum is the sum of four numbers.

Floating average; //Define floating-point average, that is, decimal.

Scanf ("%d% d% d", & i, & ampb & amp;; c,& ampd); //Input function

sum = a+b+c+d; //sum

Average value = sum /4+ sum% 4; //Calculate the average value, with the integer part in front and the decimal part in the back.

Printf("%f\n ",average); //Print the results

Returns 0; //End the return

}