Declare: int arr[5]; — 5 integers, indices 0 to 4.
Use in loop: for (i = 0; i < 5; i++) — never use i <= 5 for arr[5].
Read: scanf("%d", &arr[i]); — don't forget &.
Use arrays to store multiple values under one name. Remember: index starts at 0!
Declare: int arr[5]; — 5 integers, indices 0 to 4.
Use in loop: for (i = 0; i < 5; i++) — never use i <= 5 for arr[5].
Read: scanf("%d", &arr[i]); — don't forget &.
Declare an array of 5 integers. Use a for loop to read 5 numbers from the user into the array. Then use another for loop to print them in one line.
Use an array of size 10. Fill it (from user or with initializer). Compute the sum of all elements, then print the average (sum / 10.0).
Take an array of 5 numbers. Find the largest and smallest value. Print: "Max = ... Min = ...".
Ask the user how many students (e.g. N = 5 or 10). Declare an array of that size. Read N marks, compute and print the average. (Like we did in the session for 50 students!)