fork download
  1. /*******************************************************************************
  2. * Calculate The Average Value
  3. *
  4. *__________________________________________________________
  5. * Holds five pre determined numbers then adds them together and divides them by five, therefore finding the average.
  6. *____________________________________________________________
  7. *OUTPUT
  8. * Code prints average value
  9. *******************************************************************************/
  10. #include <iostream>
  11. using namespace std;
  12.  
  13. int main() {
  14. int nums[5]{28, 32, 37, 24, 33};
  15. float sum = nums[0] + nums[1] + nums[2] + nums[3] + nums[4];
  16.  
  17. cout << sum/5;
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
30.8