麻烦大家帮我看道题,谢谢!:)
float sum(float a[], int n){ float s=0.0; for (int i=0; i<n; i++) s+=a[i]; return s;}
计算所有语句的总执行次数。我求的是3n+2,它的答案是2n+3?
谢谢大家!
for (int i=0; i<n; i++) s+=a[i];是2nfloat s=0.0;(=float s; s=0.0)return s;是2+1所以是2n+3