balrougelive

Untitled

Aug 8th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #pragma warning(disable: 4996)
  4. #define ARRAY_LENGTH 10
  5.  
  6. void main()
  7. {
  8. int intArray[ARRAY_LENGTH];
  9. int arraySum = 0;
  10.  
  11. for (int i = 0; i < ARRAY_LENGTH; i++)
  12. {
  13. intArray[i] = i;
  14. }
  15.  
  16. for (int i = 0; i < ARRAY_LENGTH; i++)
  17. {
  18. arraySum += intArray[i];
  19. }
  20.  
  21. printf("The total of the array is %d.\n", arraySum);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment