fork download
  1. #include <iostream>
  2. #include <ctime>
  3. using namespace std;
  4.  
  5. int main() {
  6. const int Size1 = 10;
  7. int tem[Size1];
  8. float ser=0;
  9. srand (time(NULL));
  10. for(int i=0; i<Size1; i++)
  11. {
  12. cout<< i+1 << "\t";
  13. tem [i]=rand()%8-3;
  14. cout << tem[i] << "\n";
  15. ser += tem[i];
  16. }
  17. cout << "\n";
  18. cout <<ser/Size1 << endl;
  19. cout << "\n\n";
  20. }
Success #stdin #stdout 0s 4396KB
stdin
Standard input is empty
stdout
1	2
2	-3
3	-1
4	-1
5	-1
6	1
7	-1
8	0
9	2
10	-1

-0.3