fork download
  1. #include<iostream>
  2. #include<limits.h>
  3. using namespace std;
  4. int main(int argc, char const *argv[])
  5. {
  6. int N;
  7. cout<<"give N";
  8. cin>>N;
  9. int t[N], min=INT_MAX, max=INT_MIN, somme=0;
  10. float moy;
  11. for (int i = 0; i < N; ++i)
  12. {
  13. cin>>t[i];
  14. }
  15.  
  16. for (int i = 0; i < N; ++i)
  17. {
  18. somme+=t[i];
  19. max=t[i]>max?t[i]:max;
  20. min=t[i]<min?t[i]:min;
  21. }
  22. moy=N!=0?(float)somme/N:0;
  23.  
  24. cout<<"Max= "<<max<<"\tmin= "<<min<<"\tmoy= "<<moy;
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
give NMax= 2147479976	min= -2147153920	moy= -24752.9