current position:Home>C language, find the average, when outputting the result, use %d to output an integer, and use %f, %lf to output 0.0000

C language, find the average, when outputting the result, use %d to output an integer, and use %f, %lf to output 0.0000

2022-08-06 07:06:57CSDN Q&A

Problem and background

C language, find the average, use %d to output an integer, and use %f, %lf to output 0.0000

#include #include /* run this program using the console pauser or add your own getch, system("pause")or input loop */int main(int argc, char *argv[]) { int a,b,i,j,k,l,m; b=0span>; a=0; i=0; j=0; k=0; l=0; m=0; scanf("%d",&b); while(b>a){ scanf("%d",&i); j=j+i; a++; } k= j*1.0; l = b*1.0; m = k/l; printf("%d",m); return 0;}

copyright notice
author[CSDN Q&A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/218/202207301529162734.html

Random recommended