Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program to find average of the elements of an array.
- #include<stdio.h>
- #include<conio.h>
- void main() {
- int arr[5] = {2, 4, 7, 9, 8};
- int i = 0;
- float avg = 0;
- clrscr();
- for(i = 0; i < 5; i++)
- avg = avg + arr[i];
- avg = avg / i;
- printf("The average of the elements of the array is: %f", avg);
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment