Traditional Culture Encyclopedia - Photography and portraiture - C language programming: array is required. First enter a positive integer n, and then enter n integers to find their average (keep two decimal places)
C language programming: array is required. First enter a positive integer n, and then enter n integers to find their average (keep two decimal places)
float a[ 10],sum,m;
int n;
sum = 0;
scanf("%d ",& ampn); //Note that the input value of n should be less than the array length you defined.
for(I = 0; I & ltn;; i++)
scanf("%f ",& ampa[I]);
for(I = 0; I & ltn;; i++)
sum = sum+a[I];
m = sum/n;
printf("%.2f ",m); The .2 in //%.2f can control the output to keep two decimal places.
- Previous article:Introduction skills of folk photography
- Next article:Gender emotional quotations copywriting
- Related articles
- How is Wang Linbo's training in Lotus Language implemented?
- What does a movie selector do?
- The photographer's dream match
- 5g related university majors: What are the majors involved in 5g?
- How about Fujian Bozhitang Media Co., Ltd.?
- The sweetness written on the face, celebrating the second anniversary of Lynk & Co 02, JK uniforms are shown
- Opening hours of Tianjin subway
- Children's Photography Promotes Yi Labao
- What about Wenzhou Focus Technology Co., Ltd.?
- Introduction of Shanghai Huatian in Hangzhou Bay